Click to See Complete Forum and Search --> : Bulk-renaming Files


youngtomedison
09-27-2007, 10:18 AM
I have about 90 files in one directory whose 3-character extensions I need to change. How can I bulk-rename files, either in KDE or in the terminal?

ph34r
09-27-2007, 10:34 AM
for i in `ls -1 *.abc`
do
nn=`echo $i | sed s/\.abc/\.xyz`
cp $i $nn
done

retsaw
09-27-2007, 11:11 AM
Let me fix that code for you, to save bwkaz from pointing it out using ls in there is a waste of a process, you also need to put the variables in quotes in case the filenames have spaces in them.
for i in *.abc
do nn=`echo "$i" | sed s/\.abc/\.xyz`
mv "$i" "$nn"
doneYou could also use KRename if you want to do it using a GUI program.

hlrguy
09-27-2007, 11:26 AM
krename

Discovered this a couple of years back.

TripleII

happybunny
09-28-2007, 09:16 PM
http://www.icewalkers.com/Linux/Software/520460/mvb.html

blackbelt_jones
09-29-2007, 11:09 AM
Krename looks promising. I just installed it, and it makes me wish I had some files to rename. I will soon enough. If I know youngtomedision, this is the solution he's going to prefer. And you're in luck, tom, cause it says that krename is a part of debian, so you won't even have to compile it from source like I did for Vector.