partial finds

David C Lawrence tale at cs.rpi.edu
Sat Jan 6 19:05:36 AEST 1990


In <12847 at cbnews.ATT.COM> res at cbnews.ATT.COM (Robert E. Stampfli) and
in <104 at melpar.UUCP> toppin at melpar.UUCP (Doug Toppin) both ask
essentially the same question about the find command.  The manual
page provides the solution, but find is admittedly a rather cumbersome
programme to work with at times because of its curious array of arguments.

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

find DIR -name EXCLUDEDIR -prune -o WHATEVER

DIR would be the directory to start the search in, as usual.
EXCLUDEDIR is the name of the local component (basname) of the
directory -- unfortunately something like "src/test" to just exclude
test directories under source directories won't work.  WHATEVER would
be the normal arguments for whatever you are doing, "-type f -ls" or
"-name '*.c' -print" or "WHATEVER" :-).

This should probably be added to Frequently Asked Questions which
makes reference to find(1) being a powerful command and encourages
learning it, but a lot of people just can't learn from the manual
page.  A pointer to one or two better sources of information about it
would be good.

Dave
-- 
   (setq mail '("tale at cs.rpi.edu" "tale at ai.mit.edu" "tale at rpitsmts.bitnet"))



More information about the Comp.unix.questions mailing list