Cia*_*ian 28
如果你有 GNU find 那么你可能想要
find <directory name> -name '*.pyc' -delete
Run Code Online (Sandbox Code Playgroud)
如果你需要一些便携的东西,那么你最好
find <directory name> -name '*.pyc' -exec rm {} \;
Run Code Online (Sandbox Code Playgroud)
如果速度很重要并且你有 GNU find 和 GNU xargs 那么
find <directory name> -name '*.pyc' -print0|xargs -0 -p <some number greater than 1> rm
Run Code Online (Sandbox Code Playgroud)
然而,这不太可能给您带来如此大的加速,因为您将主要等待 I/O。
使用命令查找:
find /path/to/start -name '*.pyc' -exec rm -f {} \;
Run Code Online (Sandbox Code Playgroud)