RFC: "-exit" option for find(1)
Peter Pentchev
roam at ringlet.net
Fri Jul 16 07:29:03 PDT 2004
On Fri, Jul 16, 2004 at 11:58:07AM +0400, Denis Antrushin wrote:
> Alfred Perlstein wrote:
> >I'm up too late, this doesn't work because find returns
> >success whenever it successfully runs thought everything.
> >
> >Perhaps the primary change to just "-exit" which would
> >make find exit successfully, and if the primary is never
> >encountered (ie. our find logic never hits it) find would
> >exit with a non-zero exit status?
> >
> >Ideas? Better ideas?
> >
> >The reason I want this is to avoid extracting a tarball
> >over a directory that has files in it that are newer than
> >the tarball.
> >
> >Neither tar nor find seem to make this easy...
> What about this:
>
> test -n "`find . -type f -newer ../src.tar.gz`" && echo hi
I believe Alfred's problem with this is that it will still traverse the
whole hierarchy even after a match is found. In some cases, the
hierarchy may be huge, and if the match is within the first 100-200
files, well... :)
I wonder if it wouldn't be a bit better to add to find(1) something like
-maxmatches N, similar to Alfred's idea, but not limited to a single
match?
G'luck,
Peter
--
Peter Pentchev roam at ringlet.net roam at sbnd.net roam at FreeBSD.org
PGP key: http://people.FreeBSD.org/~roam/roam.key.asc
Key fingerprint FDBA FD79 C26F 3C51 C95E DF9E ED18 B68D 1619 4553
No language can express every thought unambiguously, least of all this one.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20040716/73c86c84/attachment.bin
More information about the freebsd-hackers
mailing list