[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: RFC: "-contains" option
From: |
James Youngman |
Subject: |
Re: RFC: "-contains" option |
Date: |
Sat, 21 Feb 2009 18:54:42 +0000 |
On Sat, Feb 21, 2009 at 6:20 PM, Eddie Kohler <address@hidden> 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.