partial finds

Guy Harris guy at auspex.auspex.com
Sun Jan 7 10:01:27 AEST 1990


>The solution lies in the -prune option; both Robert's and Doug's cases
>would use it in the same way:

Not necessarily.  "-prune" is a Sunism; although it's in the version of
"find" distributed with the NFS source code, and will, I think, be in
System V Release 4 (it's in SVID Issue 3, so it had *better* be in
S5R4!), it's not in every version of "find" out there.  I suspect the
version of "find" that came with the Xenix that one of the people in
question had included "-prune"; I don't know what version of UNIX the
other person had, but it might or might not have "-prune". 

On top of that,

>find DIR -name EXCLUDEDIR -prune -o WHATEVER

would stop the search at *any* directory named EXCLUDEDIR, which is a
*component* name, not a *path* name; this would permit you to prevent
"find" from searching *any* directory named "test", but wouldn't permit
you to prevent "find" from searching "/u" and "/usr/src" unless you knew
that no other directories that you wanted to search were named "u" or
"src".

To fix the latter problem, I'd be tempted to try enumerating all
directories under "/" other than "/u" and "/usr", and all directories
under "/usr" other than "/usr/src", and hand that list of directories to
"find" as the set of directories it should search (all versions of
"find" with which I'm familiar take a *list* of directories to search,
not just a single directory). 



More information about the Comp.unix.questions mailing list