What do I need to do to rsync on Windows to make it keep special characters in filenames on Linux?
Solution 1
Adding the parameter
--iconv=ISO-8859-1,utf-8
seems to have sorted the problem out.
Solution 2
I got files with weird characters to work using cygwin's rsync 3.1.2, installed via setup-x86_64.exe
, and NOT DeltaCopy's rsync, which seems to use an outdated cygwin1.dll
.
Related videos on Youtube
Richard C
Updated on September 17, 2022Comments
-
Richard C over 1 year
We're in the process of implementing an offsite backup of all our servers to a remote Linux server. We're using
rsync
over SSH. What I've found is that characters such as ñ, ö, ô and ã are replaced on the Linux server with underscores. I don't mind if it changes these characters in the filenames of documents, but when it renames a language pack fromEspañol.clx
toEspa_ol.clx
, it could cause issues for us further down the line.My current command-line is:
rsync -v -rlt -z --chmod=a=rw,Da+x -u --delete -e "ssh -i <keyfile>" <source> <destination>
What do I need to do differently to make the special characters copy over correctly?
EDIT: For the initial sync which will take place locally, before the machine is moved offsite, I have SAMBA enabled. I am able to copy files from Windows to the Samba share, retaining the original filename, though it looks different in the Linux directory listing, i.e.
têst
becomestêst
. These files get deleted by rsync when it runs, as it does not match the filenames.-
Richard C over 13 yearsThis question superuser.com/questions/91967/rsync-character-set-problems is similar, but not relevant. I'm not mounting the Windows share in Linux, rather using the rsync client on the Windows machine directly.
-
matthias krull over 13 yearstake a look at rsyncs --iconv option
-
Richard C over 13 yearsWhen I use --iconv=utf-16, which is, as I understand it, the encoding that windows uses, rsync dies with: [sender] cannot convert filename: . (Invalid argument)
-