[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cobalt-users] Rename Mult Files



At 03:19 PM 2/16/2004, you wrote:
Hi,

Hope all is well with everyone...
How do you rename mult files in the same directory?
I have a dir with about 400 filename.jpg in it...most of them have incorrect
file names such as filename.jpg.jpg
I try mv filename.jpg.jpg to filename.jpg and it works fine...
I try mv *.jpg.jpg to *.jpg
But it says I need to use a directory...Is there a way that I can change
mult file in the same directory?


for FILE in `ls -1 *.jpg.jpg`
do
  NEWFILE="`echo $FILE | sed 's/.jpg.jpg/.jpg/'`"
  mv $FILE $NEWFILE
done

Watch your quotes!

to be safer:

mkdir SAFE
for FILE in `ls -1 *.jpg.jpg`
do
  NEWFILE="`echo $FILE | sed 's/.jpg.jpg/.jpg/'`"
  cp $FILE SAFE/
  mv $FILE $NEWFILE
done




Thanks in advance

Regards,
Mitch
MissWebhost.com



_____________________________________
cobalt-users mailing list
cobalt-users@xxxxxxxxxxxxxxx
To subscribe/unsubscribe, or to SEARCH THE ARCHIVES, go to:
http://list.cobalt.com/mailman/listinfo/cobalt-users