Archive for May 12th, 2011
Every now and then I’ll run into an issue with a website’s uploader. They ask me to upload a picture, but then when I click their upload button, none of my pictures appear in the dialog. After troubleshooting for a few, it turns out that they’re limiting file masks to [*.jpg, *.jpeg, *.bmp, *.png] etc. But — because I copied my pictures over from a windows installation, they have all-capital file extensions. Linux uses a case-sensitive file system, so it regards these as different. Renaming a file to a lowercase extension [*.jpg] caused it to show up in the dialog which is what I wanted — but manually renaming thousands of pictures in dozens of directories was out of the question.
I could have written a bash script to do the renaming in a few minutes but I found something better — convmv. This simple utility makes filename conversions / renaming a breeze. By default, it runs in ‘test’ mode so that you can see what will happen before it does the job.
For my case, I needed to rename all the files to lowercase, so I used:
convmv --lower *
That showed me a verbose listing of everything it would do (test mode). However, I wanted to do the entire Pictures folder and everything under it. The new command from my Pictures folder became:
convmv --lower -r *
To get it to actually do the job, I had to specify
--notest as well.
convmv --lower -r --notest *
It did it’s work within seconds and everything was lowercase. In my opinion, much easier and better than a bash script.
Convmv has plenty of other options, so next time you need to do filename conversion, check it out.
Questions, comments, feedback? Please share in the comments below. Thank you.