问一个find的问题,关于-prune
关于find的prune问大家一个find的低级问题,我以前遇到这个问题到现在也没解决。
我想查找/目录下的所有目录,但不包括/proc如何做到 ?
find / -type d -path "/proc" -prune -o -print
结果并不是我想的那样 -path pattern
File name matches shell pattern pattern. The metacharacters do not treat `/' or `.' specially; so, for example,
find . -path './sr*sc'
will print an entry for a directory called './src/misc' (if one exists). To ignore a whole directory tree, use -prune rather than checking every file in the tree. For example, to skip the directory `src/emacs' and all files and directories under it, and print the names of the other files found, do something like this:
find . -path './src/emacs' -prune -o -print 我看过man才发帖的,单引号和双引号在这里都是没有影响的,我最后发现问题所在是上面这条命令应该这样写
find / -path "/proc" -prune -o -type d-print
仅仅是-type换了下位置,就解决了这个问题,我又想到另外一个
find 这个选项是忽略一个目录或文件,但我想忽略多个目录又该如何呢 ?
比如我想忽略/下的/etc ,/proc怎么弄呢?
man里的prune好象没有提到这个问题
我也试过自己创造性的使用,没有成功
页:
[1]