Renaming multiple files on linux the easy way
the way of the command line ;-)
Have you ever needed to change the extension of your digital camera photos from JPG to jpg? I have and it sure is a tedious task. Using a simple bash loop the job can be done with no major problem. Here’s what you need to rename a bunch of files from .JPG to .jpg:
$ for i in *.JPG; do mv “$i” “${i/.JPG}”.jpg; done
You can see that we’re using a for loop and the mv command, wich is a standard command and is available on any linux system. The quotes prevents problems with white spaces on filenames.
0 comments
