Published in: Bash
Manipulate the names of all the files in a folder in bash
for FILE in * ; do NEWFILE=`echo $FILE | sed 's/-//g'` ; mv "$FILE" $NEWFILE ; done
Comments
Subscribe to comments
You need to login to post a comment.
bash Cookbook: Solutions and Examples for bash Users
bash Cookbook teaches shell scripting the way Unix masters practice the craft. It presents a variety of recipes and tricks for all levels of shell programmers so that anyone can become a proficient user of the most common Unix shell -- the bash shell -- and cygwin or other popular Unix emulation packages.
benpjohnson on 09/13/07
4 people have marked this snippet as a favorite
basicmagic
moonbather
ss44
knuton
Published in: Bash
Manipulate the names of all the files in a folder in bash
for FILE in * ; do NEWFILE=`echo $FILE | sed 's/-//g'` ; mv "$FILE" $NEWFILE ; done
Subscribe to comments
You need to login to post a comment.
replace mv with echo to trial a new rename method
replace mv with echo to trial a new rename method