To make sure that you do not destroy your real files make a copy to temporary folder.
# mkdir /tmp
# cd tmp
Now, I’m in the folder /tmp. Currently, this is a empty working directory. We make 500 new files in the extension .dot as the following:
# for x in {1..500};
do
touch “file$x.dot”;
done
And 200 new files as Gif images
# for x in {1..200};
do
touch “testimage$x.gif”;
done
Now, how can I rename all files .dot to .bak in the folder /tmp? The following command can solve this problem.
# for x in *.dot;
do
mv “$x” “${x%.dot}.bak”;
done
Other example :
# for x in *.mov;
do
mv “$x” “${x%.mov}.flv”;
done