A commandline-preciousness for converting filename encoding in Linux: convmv

I want to share a very usefull Linux software I discovered yesterday: convmv. This tool converts filenames from one encoding to another… and it does it well.
I was facing warnings from my Ubuntu filesystem when viewing the contents of a folder I just copied there. The contents of that particular folder were various pictures of various sources. And apparently different filename-encodings were used: Ubuntu complained “(ung├╝ltige Kodierung)” (that is german for illegal encoding) on files with german umlauts that originally came from some sort of Windows operating system. I guessed that these filenames were encoded in cp1252.
I wanted to have a tool to do the filename conversion for me, and faintly remembered stumbling on such a software once. Google helped and with a quick

sudo apt-get install convmv

I was ready to check if convmv did the job for my situation. I issued a

convmv -f cp1252 -t utf8 *

in the folder containing the file with illegal encoding and … yes: works like a charm. Actually the above command will only print out a list of conversions that would be done, no actual mv command is executed. If you like what you see, you can actually execute the recoding using:

convmv -f cp1252 -t utf8 --notest *

This a very nice tool and it absolutely saved my day.

Posted in linux. 2 Comments »