Re: Renaming/Moving a Group of Filenames

From: Green, Simon (Simon.Green@EU.ALTRIA.COM)
Date: Fri Jan 30 2004 - 11:25:10 EST


Not quite a single command, but fairly simple...

for FileName in `ls *.txt`
do
 mv $FileName ${FileName%.txt}.xyz
done

--
Simon Green
Altria ITSC Europe Ltd
AIX-L Archive at https://new-lists.princeton.edu/listserv/aix-l.html
New to AIX? http://publib-b.boulder.ibm.com/redbooks.nsf/portals/UNIX
N.B. Unsolicited email from vendors will not be appreciated.
Please post all follow-ups to the list.
> -----Original Message-----
> From: Mark Monroe [mailto:mark.monroe@FORMSANDSUPPLY.COM]
> Sent: 30 January 2004 16:01
> To: aix-l@Princeton.EDU
> Subject: Renaming/Moving a Group of Filenames
>
>
> I need help with something that I think is very simple.  My
> mind is over thinking the process and I cant seem to think of
> any easy way to accomplish something.
>
> I have a several files in a directory such as this:
>
> test001.txt
> test002.txt
> test003.txt
> test004.txt
>
> I want to rename the extension on the whole list to be
> something different like this:
>
> test001.xyz
> test002.xyz
> test003.xyz
> test004.xyz
>
> Is there an easy way with the cp or mv command to take
> test*.txt and create the new files as test*.xyz?


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