Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

I would like to sync several folders on my local Mac with a remote server via SFTP. As the existing umlauts appear to be problematic for my syncing software (Deltawalker), I am looking for a way ro rid the filenames of any problematic characters.

There are several programmes (I am currently trying PowerRenamer, but there are several to replace characters based on regular expressions but I can't seem to figure out what kind of RegExp I need to use. Replacing single occurrences are easy but having a list of transliterations (i.e. ä/ae,ü/ue,ß/ss,â/a, etc.) seems to be beyond my skills.

Is there anything that I could use as a RegExp? The software uses the RegexKit framework.

Thanks, Helge.

share|improve this question

Two ways you could remove characters with diacritics in a shell script:


echo -n "$chars" | iconv -c -f utf-8 -t us-ascii//TRANSLIT | tr -d "\"\`^'"
#=> aeeeessEUR

echo -n "$chars" | sed 's|ä|ae|g;s|ß|ss|g' | tr -C '\000-\200' '_'
#=> ae____ss___

Batch-renaming files after finding them recursively:

touch ~/Desktop/test\ {ää,öö}.txt
find ~/Desktop/ -maxdepth 1 -iname "test*" |
while read f; do
    mv "$f" "$(tr -C '\000-\200' '_' <<< "$f")"
share|improve this answer

There is already a way out in your situation: use several "rounds" of renaming, for each character.

Anyway, a single classical regex pattern is only a single case. You will need more expressive constructions in your renaming programming language to express what you want than just a regex pattern&replacement.

For example, sed (a standard Unix stream editor) allows to put several "substitute" commands (s) into one program (like this: s/a/AA/g;s/b/BB/g); they would be applied sequentially to each line of input. A Unix user with some scripting/shell skills could combine sed with file renaming commands to achieve what you want. Are you willing to learn some Unix shell?

share|improve this answer
Asked for help to complete my answer: <…; -- write an elegant renaming command. – imz -- Ivan Zakharyaschev Nov 21 '11 at 15:46

An elegant Utility / Script to mass rename on the command line is the perl rename utility (see CPAN - its from Larry Wall).

My not so elegant use of this tool to rename the whole subtree of the current direcotry (all german umlauts in different (also broken UTF-8) encodings to ASCII) is :

find ./ -print0 | xargs -0 -L1 -I{} rename -n 's/ä/ae/g;s/ö/oe/g;s/ü/ue/g;s/Ö/Oe/g;s/Ü/Ue/g;s/Ä/Ae/g;s/ß/sz/g;s/\x75\xcc\x88/ue/g;s/\x61\xcc\x88/ae/g;s/\x6f\xcc\x88/oe/g;' "{}"

This prints out whats done. Remove the -n to get the real thing.

share|improve this answer

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.