[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: OT: Bash Scripting Question



On Sat, 2005-04-09 at 01:37 -0400, Hal Vaughan wrote:
> On Saturday 09 April 2005 01:33 am, Darryl Clarke wrote:
> > On Apr 9, 2005 1:17 AM, Hal Vaughan <hal@thresholddigital.com> wrote:
> > > I could swear I remember doing this in the past, but I can't remember
> > > how, and I hope it wasn't through a recursive script.
> > >
> > > I've gone through the man and info pages on ls, but I can't find anything
> > > (unless I missed the obvious, which has been known to happen before) to
> > > use to show a way to print out the full path name for EACH file or
> > > directory in a recursive listing?
> > >
> > > Thanks!
> >
> > FILES=`ls`
> > PWD=`pwd`
> >
> > for FILE in $FILES;
> > do
> >    echo $PWD/$FILE;
> > done
> >
> 
> Thanks, but that does for THIS directory, but I'm trying to get the full path 
> for every file in a recursive listing, so if there's a file 3 directories 
> deep, I'll get the full pathname for it, instead of just the file name.

find . -printf "`pwd`/%P\n"

(If you don't need the FULL pathname, but only from the current
directory on up, then just take out the `pwd`/ part.)

-- 
Alex Malinovich
Support Free Software, delete your Windows partition TODAY!
Encrypted mail preferred. You can get my public key from any of the
pgp.net keyservers. Key ID: A6D24837

Attachment: signature.asc
Description: This is a digitally signed message part


Reply to: