LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1531|回复: 4

find怎么就没有排除指定目录呢

[复制链接]
发表于 2007-8-14 01:22:56 | 显示全部楼层 |阅读模式
[root@localhost home]# find /home -path "/home/peter/" -prune -o -name infor? -exec ls -l {} \;
-rw-rw-r--  1 tom tom 5 Aug  5 09:09 /home/tom/mybin/inform
-rw-r--r--  1 root root 0 Aug 13 02:16 /home/inform
-rw-r--r--  1 root root 1954 Jul 30 05:47 /home/peter/mybin/inform
[root@localhost home]# find --version
GNU find version 4.1.20


看到网上find的帮助都是这么说的  我的机器上怎么就不行呢?

:help:help
发表于 2008-2-2 17:47:43 | 显示全部楼层
--exclude
回复 支持 反对

使用道具 举报

发表于 2008-2-3 08:57:59 | 显示全部楼层
find 没有 --exclude 参数吧.

也许只能利用 find 加 grep 来处理了
回复 支持 反对

使用道具 举报

发表于 2008-2-3 09:19:57 | 显示全部楼层
$ ls *
a/kk    b/kk   c/kk

$ find . -path ./a -prune  -o -name kk -print
./b/kk
./c/kk


$ find --version
find (GNU findutils) 4.3.12
回复 支持 反对

使用道具 举报

发表于 2008-2-3 11:39:29 | 显示全部楼层
$ mkdir -v a b c; touch ./{a,b,c}/touche; ls *
mkdir: 已创建目录 “a”
mkdir: 已创建目录 “b”
mkdir: 已创建目录 “c”
a:
touche

b:
touche

c:
touche
$ find . -path ./a -prune -o -name 'touche' -print
./b/touche
./c/touche
$ find --version | sed -n -e '1p'
GNU find 版本 4.2.29
回复 支持 反对

使用道具 举报

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

本版积分规则

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