From owner-freebsd-questions Thu Aug 1 20:58:38 2002 Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 827C437B40D for ; Thu, 1 Aug 2002 20:58:28 -0700 (PDT) Received: from ns5.eds.com (ns5.eds.com [203.17.185.230]) by mx1.FreeBSD.org (Postfix) with ESMTP id 15B6943E70 for ; Thu, 1 Aug 2002 20:58:27 -0700 (PDT) (envelope-from siegfried.pietralla@eds.com) Received: from nnsy.eds.com (nnsy-3.eds.com [192.168.1.1]) by ns5.eds.com (8.11.6/8.11.1) with ESMTP id g723vuf12565; Fri, 2 Aug 2002 13:57:57 +1000 (EST) Received: from nnsy.eds.com (localhost [127.0.0.1]) by nnsy.eds.com (8.11.6/8.11.6) with ESMTP id g723vs802274; Fri, 2 Aug 2002 13:57:54 +1000 (EST) Received: from ausym000.exau01.exch.eds.com ([134.251.177.117]) by nnsy.eds.com (8.11.6/8.11.6) with ESMTP id g723vrj02266; Fri, 2 Aug 2002 13:57:53 +1000 (EST) Received: by AUSYM000 with Internet Mail Service (5.5.2653.19) id ; Fri, 2 Aug 2002 13:57:35 +1000 Message-ID: <16649A8D5C73D51183B80008C728EEB7CC0AD5@AUSYM103> From: "Pietralla, Siegfried P" To: "'John Mills'" , Maciej Szewczyk Cc: questions@FreeBSD.ORG Subject: RE: files to files with .txt Date: Fri, 2 Aug 2002 13:58:20 +1000 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2653.19) Content-Type: text/plain; charset="ISO-8859-1" Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG > -----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 " ; for i in * ; do echo mv $i $i.txt ; done | sh to execute it. regards, siegfried. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message