Rename Multiple Files

I have a number of files


I would like a simple method for moving/renaming them


Note the only thing that changes is the PROD to TEST, in file and dir name.

I need to this in a script, so loops are fine, will be run via cron, the file numbers change daily. They will not always have the exact _1, _2, _3, this is an incremental number.

Any help?


cd /u01/PROD
for file in arch*; do

newfile=`echo $file | sed 's/PROD/TEST/'`
mv $file ../TEST/$newfile


This will rename every *PROD* file in the PROD directory to a corresponding *TEST* name in the TEST directory.


[Edited by PxT on 11-14-2000 at 11:42 AM]