OT: find command permissions: how to exclude dir?

Gordon Messmer yinyang at eburg.com
Wed Nov 5 07:50:04 UTC 2008


Rick Stevens wrote:
> Gordon Messmer wrote:
>> You need to tell find what to do with files not named .gvfs:
>>
>> find /users/tburns -name .gvfs -prune -o -print
> 
> Will not work.  As soon as the non-owner of .gvfs does a stat on the
> directory, the error will be spit out.  find must "stat()" any item
> it finds to handle the remainder of the predicate and POP goes the
> error.

If -name is the first predicate, and you prune matches, find will not 
need to stat() the directory entry:

[gordon at herald:~/tmp/findtest]$ find . -print
.
./noread
find: `./noread': Permission denied
./read
./read/file

[gordon at herald:~/tmp/findtest]$ find . -name noread -prune -o -print
.
./read
./read/file




More information about the users mailing list