QQ登录

只需一步,快速开始

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 1003|回复: 2

问一个find的问题,关于-prune

[复制链接]
发表于 2005-8-11 14:52:10 | 显示全部楼层 |阅读模式
关于find的prune      

问大家一个find的低级问题,我以前遇到这个问题到现在也没解决。
我想查找/目录下的所有目录,但不包括/proc如何做到 ?
find / -type d -path "/proc" -prune -o -print
结果并不是我想的那样
发表于 2005-8-12 07:49:05 | 显示全部楼层
-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
回复

使用道具 举报

 楼主| 发表于 2005-8-13 11:33:59 | 显示全部楼层
我看过man才发帖的,单引号和双引号在这里都是没有影响的,我最后发现问题所在是上面这条命令应该这样写
find / -path "/proc" -prune -o -type d  -print
仅仅是-type换了下位置,就解决了这个问题,我又想到另外一个
find 这个选项是忽略一个目录或文件,但我想忽略多个目录又该如何呢 ?
比如我想忽略/下的/etc ,/proc怎么弄呢?
man里的prune好象没有提到这个问题
我也试过自己创造性的使用,没有成功
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

GMT+8, 2024-7-8 11:44 , Processed in 0.072457 second(s), 16 queries .

© 2021 Powered by Discuz! X3.5.

快速回复 返回顶部 返回列表