macos 递归擦除隐藏文件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8680793/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Recursive erase hidden files
提问by Antonio Max
I'm trying to recursive erase all files that begin with "._" (aka mac dot files) on my server using SSH. The files are listed with a ls -a but this won't work:
我正在尝试使用 SSH 在我的服务器上递归擦除所有以“._”开头的文件(又名 mac dot 文件)。这些文件用 ls -a 列出,但这不起作用:
rm -rf ._*
I know there's a way. Mind to share? Cheers!
我知道有办法。介意分享吗?干杯!
回答by Paul Tomblin
find . -name ._\* -print0 | xargs -0 rm -f
find . -name ._\* -print0 | xargs -0 rm -f
回答by Jerome Ajot
find . -name ._\* -type f -delete
Specify that it's files and just call the find-delete on item directly.
指定它的文件,然后直接调用 item 上的 find-delete。
回答by ennuikiller
find . -name ._\* -exec rm -f {} \;
by the way rm -rf is for removing directories recursively
顺便说一句 rm -rf 用于递归删除目录