Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

On various filesystems, I have a bunch of filesystem entries that have badly-encoded names (they were written with the wrong character encoding).

How can I automatically list all entries with names that are invalid for the current character encoding?

Having found all those entries, how can I automatically rename them all from one encoding to another?

share|improve this question
It would help if you could let us know which filesystem in particular. – squillman Jun 9 '09 at 5:00
Or operating system at least. – David Pashley Jun 9 '09 at 8:04
up vote 1 down vote accepted

I'd simply do a

convmv -r -f ASCII -t UTF-8 $targetdir

unless you add the --notest it won't actually do anything to your files. Defaults assume the from encoding is ASCII and to encoding is UTF-8. Pipe that thru awk '{print $2}' to only get the filenames that would be converted.

Note: I'm assuming you are using Linux. Most POSIX filesystems don't care about the encoding of filenames, however the manpage of convmv has a couple of details (also how to decode double UTF-8 encoded filenames)

share|improve this answer
What does -f ASCII -t UTF-8 do? It looks like it would convert ASCII to UTF-8, which is a no-op, as ASCII is a subset of UFT-8. – sleske Jun 10 '09 at 1:52
That is correct but I rather give noop commands than kill someone elses box and take the blame for it. Thou convmv doesn't actually do anything without the --notest. But Murphey never sleeps :) – Server Horror Jun 10 '09 at 2:12

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.