On Fri, 3 Jun 2005, John W. Krahn wrote:

> Chris Devers wrote:
> >
> > If you don't have the `locate` database on your system, you're going
> > to have to walk the while filesystem, using something like `find`.
> > Here's one way to do it, but it will be very, very, very slow:
> >
> >     $ find / -type f | grep -v '/.*/.*/.*/.*/'
>                          ^^^^^^^^^^^^^^^^^^^^^^
> Ick!  Better to use the -maxdepth switch (if it is available.)
>
>      $ find / -type f -maxdepth 4

YMclearlyV :-)

This might be the "right" way to do this, but it has always rubbed me
the wrong way. The basic Unix commands are supposed to be simple things,
with each one doing one thing well. `find` *way* overreaches.

The `find` command has far too many options for me to feel comfortable
memorizing; it seems much easier to me to just use find to generate a
list of file, then hand off that list to another tool -- not least
because, as you suggest, different `find` versions may or may not have
all the esoteric little options, but basic things like `grep` should
pretty reliably be available almost anywhere sane -- which is to say,
anywhere other than Windows. :-)

I realize that I may be in the minority opinion on this. Oh well.


-- 
Chris Devers

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to