Re: Shell script: find

From: cbaker@GOODYEAR.COM
Date: Tue Sep 09 2003 - 14:34:47 EDT


You do NOT want to do the "/someplace/.*" !!!! But rather
"/someplace/.[a-z,A-Z,0-9]*" or something of that nature.

WHY?

Because using a "/someplace/.*" in a find command will traverse UP to "/"
since it will find "/someplace/.." (TWO DOTS). This can be VERY
DANGEROUS if you are doing, say a find and an rm (remote) of what you
found. You could end up removing files in far distant directories or even
other filesystems.

With the "[a-z]" or "[0-z]" that Mr. Thompson put forth, you are
restricting the search to any character after the first "." but not another
"."

Hope that helps,

Christopher M. Baker
Senior Technical Support Analyst
DSE/TCO
Goodyear Tire and Rubber Company

=================================================
Contains Confidential and/or Proprietary Information.
May not be copied or disseminated without the expressed
written consent of The Goodyear Tire & Rubber Company.
=================================================

                      Holger.VanKoll@S
                      WISSCOM.COM To: aix-l@Princeton.EDU
                      Sent by: IBM AIX cc: (bcc: Chris Baker/NA/GDYR)
                      Discussion List Subject: Re: Shell script: find
                      <aix-l@Princeton
                      .EDU>

                      09/09/2003 08:02
                      AM
                      Please respond
                      to IBM AIX
                      Discussion List

the point of using "something/*" is to avoid the command line overflow.
this makes the shell not escaping it.
as I am sure you know this yourself, I am wondering if we´re talking about
the same

in any case its true that files starting with a dot wont be found. one
would have to use "/somewhere/*" "/somewhere/.*"

-----Original Message-----
From: Bill Thompson [mailto:bill.thompson@GOODYEAR.COM]
Sent: Tuesday, September 09, 2003 1:51 PM
To: aix-l@Princeton.EDU
Subject: Re: Shell script: find

"/some/path/*" is fine EXCEPT it will not find files that start with a
period (e.g.: ".profile") and it could overflow the command line buffer if
there are lots of files in the directory. (just like "ls -l *" can overflow
the command line buffer).

Bill Thompson
Sr UNIX Systems Administrator
The Goodyear Tire & Rubber Co.

Contains Confidential and/or Proprietary Information
May Not Be Copied or Disseminated Without Express Consent of The Goodyear
Tire & Rubber Company.

AIX-L Archives: http://marc.theaimsgroup.com/?l=aix-l&r=1&w=2

----- Original Message -----
From: <Holger.VanKoll@SWISSCOM.COM>
Newsgroups: bit.listserv.aix-l
To: <aix-l@Princeton.EDU>
Sent: Tuesday, September 09, 2003 7:00 AM
Subject: Re: Shell script: find

> > find /usr/lpp/* -prune
> > find /usr/lpp/.[0-z]* /usr/lpp/* -prune
> >Note that either of these could fail if you have too many files in
> >your
> path.
>
> it should be fine to use "/some/path/*" etc., shouldnt it? sorry, no
> time to test
>
>
> -----Original Message-----
> From: Bill Thompson [mailto:bill.thompson@GOODYEAR.COM]
> Sent: Tuesday, September 09, 2003 12:50 PM
> To: aix-l@Princeton.EDU
> Subject: Re: Shell script: find
>
>
> Rad,
>
> Let's say you were looking for all the stuff in /usr/lpp, but none of
> the subdirectories. You could use the following notation:
>
> find /usr/lpp/* -prune
>
> If you wanted to find the "hidden" files as well (those starting with
> a dot), this should work:
>
> find /usr/lpp/.[0-z]* /usr/lpp/* -prune
>
> Note that either of these could fail if you have too many files in
> your path.
>
> Another way to do it without using find:
>
> for FILE in $(ls /usr/lpp); do
> echo /usr/lpp/$FILE
> done
>
> HTH
>
> Bill Thompson
> Sr UNIX Systems Administrator
> The Goodyear Tire & Rubber Co.
>
> Contains Confidential and/or Proprietary Information
> May Not Be Copied or Disseminated Without Express Consent of The
> Goodyear Tire & Rubber Company.
>
> AIX-L Archives: http://marc.theaimsgroup.com/?l=aix-l&r=1&w=2
>
>
> ----- Original Message -----
> From: "Rioveros, Dario C." <riovdac@RSDEVT.INSULAR.COM.PH>
> Newsgroups: bit.listserv.aix-l
> To: <aix-l@Princeton.EDU>
> Sent: Monday, September 08, 2003 11:44 PM
> Subject: Shell script: find
>
> > Hi AIX people,
> >
> > I need a little help here. how can I find the files only on
> > the
> indicated PATH
> > and will not search on its subdirectories. (non-recursive find).
> >
> > Thanks.
> > rad



This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 22:17:11 EDT