Skip to content

Instantly share code, notes, and snippets.

@filviu
Created November 5, 2014 08:49
Show Gist options
  • Select an option

  • Save filviu/c1f3ecfc75b3486f67bd to your computer and use it in GitHub Desktop.

Select an option

Save filviu/c1f3ecfc75b3486f67bd to your computer and use it in GitHub Desktop.
Rename characters containing umlauts, etc. to their ascii literal equivalent
#!/bin/bash
type iconv >/dev/null 2>&1 || { echo >&2 "iconv has to be installed. Aborting."; exit 1; }
find . -type f | while read FILE; do
if [ -f "$(echo "$FILE" | iconv -f utf8 -t ascii//TRANSLIT)" ]; then
echo "No rename required: $FILE"
else
mv -v "$FILE" "$(echo "$FILE" | iconv -f utf8 -t ascii//TRANSLIT)"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment