是否有可能以某种方式使用find
命令,使其不会递归到子目录中?例如,
DirsRoot
|-->SubDir1
| |-OtherFile1
|-->SubDir2
| |-OtherFile2
|-File1
|-File2
而像find DirsRoot --do-not-recurse -type f
这样的结果将只有File1, File2
发布于 2010-10-13 23:35:26
我认为,根据您当前的命令结构,使用-maxdepth 1
选项会得到您想要的结果。如果没有,您可以尝试查看find
的man page。
有关记项(为方便起见):
-maxdepth levels
Descend at most levels (a non-negative integer) levels of direc-
tories below the command line arguments. `-maxdepth 0' means
only apply the tests and actions to the command line arguments.
你的选择基本上是:
# Do NOT show hidden files (beginning with ".", i.e., .*):
find DirsRoot/* -maxdepth 0 -type f
或者:
# DO show hidden files:
find DirsRoot/ -maxdepth 1 -type f
发布于 2010-10-13 23:35:57
我相信你是在找-maxdepth 1
。
https://stackoverflow.com/questions/3925337
复制相似问题