10
09/2014
Mac 批处理删除
find . -iname 'thumbs.db' -exec rm -rfv {} +
-r Attempt to remove the file hierarchy rooted in each file argument. The -R option implies the -d option. If the -i option is specified, the user is prompted for confirmation before each directory’s contents are processed (as well as before the attempt is made to remove the directory). If the user does not respond affirmatively, the file hierarchy rooted in that directory is skipped.
-f 不提示,即便没有权限。即使文件不存在,也不提示。(反之,-i 删除前提示)
-v 删除前,显示详细信息
{} 前面找到的文件
exec {} \; \ 标示转义
exec {} + 表示 尽量多匹配路径名
-iname 大小写敏感
The difference between ; and + is that - with ; a single grep command for each file is executed whereas with + as many files as possible are given as parameters to grep at once.
相关: