Tip: use rsync to convert filenames from/to UTF-8 <–> latin-1/ISO-8859-1

gimpe » 13 September 2009 » In tips »

This will copy files with UTF-8 encoded characters filenames to new files with a ISO-8859-1 encoded filenames and, when everything is completed, will delete the old (UTF-8) files.

BE CAREFUL THIS IS NOT FOOL PROOF :) YOU MUST KNOW WHAT YOU ARE DOING TO NOT DOUBLE ENCODE THE CHARACTERS FILENAMES.

rsync SOURCE SAMEFORDESTINATION --recursive --human-readable --stats --times --progress --iconv=utf8,iso88591 --delete-after

To do the opposite change the iconv switch to: --iconv=iso88591,utf8

Note: If you run rsync as root, you can use --owner --group to keep the same user.group for the copied files.

Tags:

Trackback URL

No Comments on "Tip: use rsync to convert filenames from/to UTF-8 <–> latin-1/ISO-8859-1"

Hi Stranger, leave a comment:

ALLOWED XHTML TAGS:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Subscribe to Comments