从终端删除文件;输出显示跳过的文件与删除的文件相对

Deleting files from terminal; output displays files skipped opposed to files deleted

OS: Mac 莫哈韦沙漠 10.14.3

我最近开始自学 python,并编写了一个命令,在更新包后执行以递归清除 "pycache" 文件夹。该命令使用自制软件中的 "trash" 公式。

cd '/Library/Frameworks/python.framework/versions/3.7'
find . -type d -name "__pycache__" -exec trash {} \;

该命令运行良好,但我的问题是关于 运行 时输出终端的显示。它不会显示每个被删除的目录,而是只显示被跳过的目录,因为它们不包含 "pycache" 个文件夹。为什么输出是这样倒过来的?

这里是输出的一部分供参考:

find: ./lib/python3.7/site-packages/pip/_vendor/urllib3/util/__pycache__: No such file or directory
find: ./lib/python3.7/site-packages/pip/_vendor/urllib3/__pycache__: No such file or directory
find: ./lib/python3.7/site-packages/pip/_vendor/urllib3/contrib/__pycache__: No such file or directory
find: ./lib/python3.7/site-packages/pip/_vendor/urllib3/packages/__pycache__: No such file or directory
find: ./lib/python3.7/site-packages/pip/_vendor/urllib3/packages/backports/__pycache__: No such file or directory
find: ./lib/python3.7/site-packages/pip/_vendor/urllib3/packages/ssl_match_hostname/__pycache__: No such file or directory

谢谢

trash 默认为静音。如果您希望它冗长,请使用 -v option:

trash -v

完整命令现在如下所示:

cd '/Library/Frameworks/python.framework/versions/3.7'
find . -type d -name "__pycache__" -exec trash -v {} \;