如何防止find
返回用作根目录的目录以从结果中开始搜索?例如:
$ find targetDir -name 'target*'
targetDir/target1
targetDir/target2
targetDir/subDir/target3
代替:
$ find targetDir -name 'target*'
targetDir
targetDir/target1
targetDir/target2
targetDir/subDir/target3
用途mindepth
:
$ find targetDir -mindepth 1 -name 'target*'
来自man find
:
-mindepth levels
Do not apply any tests or actions at levels less than levels (a
non-negative integer). -mindepth 1 means process all files
except the command line arguments.
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句