From owner-freebsd-questions Thu Aug 1 19: 4:42 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 8866337B400 for ; Thu, 1 Aug 2002 19:04:40 -0700 (PDT) Received: from otter.mills-atl.com (dsl-64-192-140-77.telocity.com [64.192.140.77]) by mx1.FreeBSD.org (Postfix) with ESMTP id A429943E42 for ; Thu, 1 Aug 2002 19:04:39 -0700 (PDT) (envelope-from jmmills@telocity.com) Received: from localhost (jmills@localhost) by otter.mills-atl.com (8.9.3/8.9.3) with ESMTP id WAA05193; Thu, 1 Aug 2002 22:06:54 -0400 X-Authentication-Warning: otter.mills-atl.com: jmills owned process doing -bs Date: Thu, 1 Aug 2002 22:06:54 -0400 (EDT) From: John Mills X-Sender: jmills@otter.mills-atl.com Reply-To: John Mills To: Maciej Szewczyk Cc: questions@FreeBSD.ORG Subject: Re: files to files with .txt In-Reply-To: <20020731230256.A19666@pirx.9lo.lublin.pl> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII 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 Hello - On Wed, 31 Jul 2002, Maciej Szewczyk wrote: > Hi, > I have about 1000 files. > ls -1 > 1 > 2 > 3 > 4 > 5 > 6 > 7 > ... > ... > 998 > 999 > 1000 > And now I must have 1000 files with .txt -> > ls -1 > 1.txt > 2.txt > 3.txt > ... > ... > 998.txt > 999.txt > 1000.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 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message