该联机帮助页仅提供以下选项:
--ignore-fail-on-non-empty
ignore each failure that is solely because a directory
is non-empty
-p, --parents Remove DIRECTORY and its ancestors. E.g., `rmdir -p a/b/c' is
similar to `rmdir a/b/c a/b a'.
-v, --verbose output a diagnostic for every directory processed
--help display this help and exit
--version output version information and exit
如何管道find
或ls
以递归方式删除文件树中的所有空目录?
答案 0 :(得分:3)
find . -type d -empty -delete
与所有破坏性命令一样,print和sanity在执行完整命令之前检查目标(省略-delete
)。