[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [cobalt-users] Rename Mult Files
- Subject: RE: [cobalt-users] Rename Mult Files
- From: "mjr" <mjr@xxxxxxxxxxx>
- Date: Mon Feb 16 17:39:01 2004
- Organization: MJR
- List-id: Mailing list for users to share thoughts on Sun Cobalt products. <cobalt-users.list.cobalt.com>
This worked...Thank you for your information...
Please disregard last email
make a file....
name it something
chmod +x something
./something
#!/bin/bash
for FILE in `ls -1 *.jpg.jpg`
do
NEWFILE="`echo $FILE | sed 's/.jpg.jpg/.jpg/'`"
mv $FILE $NEWFILE
done
>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
_____________________________________
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