指定深度
-H 3
[b][size=medium]查找当前目录内的文件(-type f)或文件夹(-type d),并按照原始目录结构复制到另一目录[/size][/b]
[b][size=medium]类似的删除特定目录下的所有特定文件夹[/size][/b]
[b][size=medium]列出指定目录及子目录包含特定字符串的所有文件名[/size][/b]
-H 3
[b][size=medium]查找当前目录内的文件(-type f)或文件夹(-type d),并按照原始目录结构复制到另一目录[/size][/b]
find fromDir -iname "filename" -type d -exec cp -fr {} toDir/{} \;
[b][size=medium]类似的删除特定目录下的所有特定文件夹[/size][/b]
find fromDir -iname "filename" -type d -exec rm -fr {} \;
[b][size=medium]列出指定目录及子目录包含特定字符串的所有文件名[/size][/b]
find fromDir -iname "filename" -type f -exec grep "string" {} \; -print