有没有办法阻止find以递归方式挖掘到子目录中?

Jon*_*son 3 unix bash shell ksh

当我做:

$ find / 
Run Code Online (Sandbox Code Playgroud)

它搜索整个系统.
我该如何预防呢?

(这个问题来自对另一个问题的" 回答 ".)

dmc*_*kee 9

考虑:

-maxdepth n
             True if the depth of the current file into the tree is less than
             or equal to n.

-mindepth n
             True if the depth of the current file into the tree is greater
             than or equal to n.
Run Code Online (Sandbox Code Playgroud)

  • 请注意,-max深度和-min深度不可移植。不过,GNU find 有这些选项,并且可以在需要时安装。 (2认同)