Sunday, April 1, 2012

Renaming part of a file in linux

Suppose you have a bunch of files named in the following format:

my-pictures-for-vacations-Rome-1.rar
my-pictures-for-vacations-Rome-2.rar

...and so on. But you just found out that you had mistakenly named your Paris pictures as those of Rome. So you want to rename them, replacing Rome with Paris. All you have to do is the following:

for f in *.rar;
do
x = $(f/Rome/Paris);
done


No comments: