Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 2 Aug 2002 17:34:52 -0600
From:      Kyle Butt <kylebutt@myrealbox.com>
To:        "Pietralla, Siegfried P" <siegfried.pietralla@eds.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: files to files with .txt
Message-ID:  <20020802173452.A368@kylebutt.dorms.usu.edu>
In-Reply-To: <16649A8D5C73D51183B80008C728EEB7CC0AD5@AUSYM103>; from siegfried.pietralla@eds.com on Fri, Aug 02, 2002 at 01:58:20PM %2B1000
References:  <16649A8D5C73D51183B80008C728EEB7CC0AD5@AUSYM103>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Aug 02, 2002 at 01:58:20PM +1000, Pietralla, Siegfried P wrote:
> > -----Original Message-----
> > From: John Mills [mailto:jmmills@telocity.com]
> > Sent: Friday, 2 August 2002 12:07
> > To: Maciej Szewczyk
> > Cc: questions@FreeBSD.ORG
> > Subject: Re: files to files with .txt
> > 
> > 
> > Hello -
> > 
> > On Wed, 31 Jul 2002, Maciej Szewczyk wrote:
> > 
> > > Hi,
> > > I have about 1000 files.
> > > ls -1
> > > 1
> > > 2
> .
> .
> .
> > > And now I must have 1000 files with .txt ->
> > > ls -1
> > > 1.txt
> > > 2.txt
> .
> .
> .
> > 
> > DISCLAIMER - This is on-the-fly - you'll probably need to 
> > tune it and/or
> > correct it. Of course you could just write it as a [bash] 
> > script. Get the
> > form right _without_ the 'mv' line, and if possible save a 
> > copy of your
> > directory before you munge the real files.
> > 
> > $ ls > ../1000_files
> > $ for FILENAME in `cat ../1000_files`
> >  > do
> >  >  echo "Renaming $FILENAME to $FILENAME.txt"
> >  >  mv $FILENAME $FILENAME.txt
> >  > done
> >  Renaming 001 to 001.txt
> >  ....
> > 
> > $
> > 
> >  - John Mills
> 
> i've found that the easiest ( and least typing ) way to check stuff like
> this is to :
> 
> for i in * ; do echo mv $i $i.txt ; done
> 
> to see what you're going to get, then just append " | sh " ;

or just remove the echo.

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020802173452.A368>