Converting filenames to UTF-8

By Filip Salomonsson; published on January 28, 2007.

Stuck with latin1 filenames in some odd corner of your harddrive?

$ ls
r?ksm?rg?s

I am. And I can't have that. So let's whip out convmv to set things straight.

I didn't have convmv on this computer, so it seemed like a good first step to install it.

$ sudo apt-get install convmv

On to the action. By default, convmv does a dry run, and doesn't actually change anything, so you can make sure it intends to do the right thing before you actually have it do it.

$ convmv -f latin1 -t utf8 *
Starting a dry run without changes...
mv "./r?ksm?rg?s"       "./räksmörgås"
No changes to your files done. Use --notest to finally rename the files.

In this case, it looks fine, so I add the --notest and go again.

$ convmv --notest -f latin1 -t utf8 *
mv "./r?ksm?rg?s"       "./räksmörgås"
Ready!

Done. You can specify any number of files and directories, and if you add the -r option, it'll work recursively on directories.

Questions?