how to use `find' non-recursively?
Narayan S. Raja
raja at bombay.cps.msu.edu
Mon Jan 28 17:15:01 AEST 1991
In article <1991Jan28.011044.16609 at ux1>, (Erik Reuter) writes:
< What I want to do is to search the current directory for all files matching
< a certain name, say -name abc\* , but I *do not* want find to descend into
< any subdirectories.
<
< find . -type d -prune -o -name abc\* -print
<
< does not seem to work, since it prunes *everything*, including the .
directory.
If you will never search for any property
other than name, plain old
ls -d abc*
should do the job.
Otherwise, the following should work, unless
file abc* is itself a directory:
find . ! -name "." -type d -prune -o -name abc\* -print
If file abc* might possibly be a directory,
find . ! -name "." ! -name abc\* -type d -prune -o -name abc\* -print
will work, but find will recursively search in
directories named abc*.
Narayan Sriranga Raja.
More information about the Comp.unix.questions
mailing list