[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 16:29:00 2004
- Organization: MJR
- List-id: Mailing list for users to share thoughts on Sun Cobalt products. <cobalt-users.list.cobalt.com>
Thanks for your help...I tried it however I must be doing something
wrong...I get an error...
cp: missing destination folder
or
mv: missing file argument
The SAFE dir is there.
Do I type it in exactly how you wrote it below or should I be making
changes?
>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