'find' - can i prune on the basis of pathnames?
Chris Torek
chris at mimsy.UUCP
Tue May 10 14:55:05 AEST 1988
In article <435 at stylus.cme-durer.ARPA> klm at cme-durer.ARPA (Ken Manheimer)
writes:
>... The problem concerns pruning absolute paths from a directory-structure
>traversal. This is as opposed to pruning relative directory-names,
>which is easy to do using a '-name <dirname> -prune' clause.
It cannot be done directly. You *can* do this:
find <path> -exec expr {} = /foo/bar \| {} = /foo/baz \; -prune -o <pred>
This will not perform <pred> on /foo/bar and /foo/baz; if you want them
done, but not any files within them, try
find <path> \( -exec expr <exprs> \; ! -prune \) -o <pred>
>Is it in fact the case that find will not perform a prune on the basis
>of a (non-trivial) pathname...?
It is. -prune simply says `do not search the current path any deeper',
and then succeeds a la -print. (At least, that is what the one I put
in on our Vaxen does, and I did it from the Sun documentation.)
>... I know i could accomplish what i want using a post-filter ...
That would probably be fastest.
--
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain: chris at mimsy.umd.edu Path: uunet!mimsy!chris
More information about the Comp.unix.questions
mailing list