Way to get find to skip a directory?

Leo Willems leo at atcmp.nl
Sun Apr 8 05:34:29 AEST 1990


>From article <133 at dynasys.UUCP>, by jessea at dynasys.UUCP (Jesse W. Asher):
> Is there a way to get find to skip a directory when searching?  An example
> would be that I want to search /usr for something but I know it's not going
> to be in /usr/spool/news.  Is there any way I can get it to search /usr
> but skip /usr/spool/news (which can take forever to scan)?  Thanx in advance.
> 

Try:

cd /usr
find `ls | grep -v spool` -print | some_prog

This implies that your version of find(1) must be able to accept more than
one starting point in a tree. Not all find versions do.

In that case try this:

(
cd /usr 
for i in `ls | grep -v spool`
do
	find $i -print
done ) | some_prog


 Leo Willems			Internet: leo at atcmp.nl
 AT Computing			UUCP:     mcvax!hp4nl!kunivv1!atcmpe!leo
 P. O. Box 1428				
 6501 BK  Nijmegen		Phone:    +31-80-566880
 The Netherlands		Fax:	  +31-80-555887



More information about the Comp.unix.questions mailing list