On Sat, Feb 21, 2009 at 6:20 PM, Eddie Kohler <[email protected]> wrote:
> Hi,
>
> I frequently use "find" to search collections of files while pruning certain
> directories.  However, I'd often like to prune build directories and the
> like,
> and these don't have consistent names.
>
> One solution is to prune directories that contain a file named
> ".find-ignore".
> This can be coded up with, e.g, "-execdir test -e .find-ignore \; -prune".
> Unfortunately, this makes find much slower -- on the relevant directory
> tree,
> "find . -type d , -true" takes 1.44s, while "find . \( -type d -a -execdir
> test -e .find-ignore \; \) , -true" takes 98.53s.

How does the performance of this kind of approach compare?

exclude=$(find . -name .find-ignore -printf '%h\n' | sort -u)
find . \! \( -false $( for e in $exclude ; do printf ' -o -name "%s" '
$e; done) \)

James.


Reply via email to