SUMMARY: find syntax

From: Donald McLachlan (don@mars.dgrc.doc.ca)
Date: Mon Aug 10 1992 - 19:09:25 CDT


First, my original problem ...

>I do not seem to be able to build a find command which will skip both
>/tmp and /home, but ls everything else.
>
>I could run the following two commands and use comm to merge their output.
>
> find / -name /tmp -prune -o -ls > /tmp/junk
> find / -name /home -prune -o -ls > /tmp/junk1
>
>But I think it would be nice to do a single find.
>
>Any and all help will be appreciated.

As it turned out, I found a functional syntax about an hour after posting, but
it did not do exactly what I wanted. (Part of my problem was forgetting to hide things from the shell.)

I wound up using
        find / -name tmp -prune -o -name home -prune -o -ls

This (as many people pointed out) will remove any file named tmp such as
/etc/tmp since -name is essentially `basename {}`. Many folks found some
interesting ways to overcome this problem.

I think the real solution (which 3 people mentioned) is to get, and use GNUfind.
I provides a -path option which compares the arg against {}. This is
what I really wanted, so I will give that a try.

Thanks to all who responded, Don

From: Lutz Brunke <brunke@dkrz-hamburg.dbp.de>
From: Robert L Krawitz <rlk@Think.COM>
From: chip@eniac.seas.upenn.edu (Charles H. Buchholtz)
From: Dieter Muller <dworkin@merlin.rootgroup.com>
From: Casper Dik <casper@fwi.uva.nl>
From: Jon Peatfield <J.S.Peatfield@damtp.cambridge.ac.uk>
From: tfpoage@ucdavis.edu (Tom Poage)
From: justice@dao.nrc.ca (Gerald Justice)
From: gorpong@sbcoc.com
From: guy@auspex.com (Guy Harris)
From: Mike Raffety <miker@sbcoc.com>
From: peters@ra.pad.otca.oz.au (Peter Samuel)
From: Clive Newall <clive@asis.unimelb.EDU.AU>
From: canver@informatik.uni-ulm.de (Ercument Canver)
From: Arie Bikker <aribi@geo.vu.nl>
From: trdlnk!mike@uunet.UU.NET (Michael Sullivan)
From: rwolf@dretor.dciem.dnd.ca
From: Joe Konczal <konczal@sunmgr.ncsl.nist.gov>



This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:06:47 CDT