OS:Mac Mojave 10.14.3
我最近开始自学python,并编写了我在更新软件包以递归清除“ pycache”文件夹后执行的命令。该命令使用自制软件的“垃圾邮件”公式。
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
谢谢
答案 0 :(得分:0)
trash
默认为静音。如果您希望它变得冗长,请使用-v
option:
trash -v
完整的命令现在看起来像这样:
cd '/Library/Frameworks/python.framework/versions/3.7'
find . -type d -name "__pycache__" -exec trash -v {} \;