Skip to content

Instantly share code, notes, and snippets.

@fedir
Created April 16, 2013 13:02
Show Gist options
  • Save fedir/5395709 to your computer and use it in GitHub Desktop.
Save fedir/5395709 to your computer and use it in GitHub Desktop.
Files with non UTF8 characters in the name detecting and rename
# encoding analyzing
find . | grep -P "[\x80-\xFF]" | iconv -f latin1 -t utf8
# test launch
find . | grep -P "[\x80-\xFF]" | rename -n 'BEGIN {binmode STDIN, ":encoding(latin1)"; use Encode;} $_=encode("utf8", $_)'
# rename
find . | grep -P "[\x80-\xFF]" | rename -n 'BEGIN {binmode STDIN, ":encoding(latin1)"; use Encode;} $_=encode("utf8", $_)'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment