Rsync to remote server over SSH - Maintain spaces in filenames
Posted on 2011-03-25
I am performing an rsync from one CentOS server to another remote CentOS server over SSH (using private keys). I am transferring a directory that contains numerous sub-directories and files - many of which contain spaces in them.
The problem is that the remote rsync is escaping the spaces in the filenames like so:
CO Ltr ID-00020 USA Ltr.docx ---> CO\ Ltr\ ID-00020\ USA\ Ltr.docx
I understanding the reasoning behind this (rsync uses spaces between arguments and filenames, etc) -- I'm just looking for a workaround.
This rsync job, once working properly, will run 4 times a day to update / transfer changes to ensure this directory is identical on both systems.
Is there any way, using rsync or another script, to ensure that filenames containing spaces are maintained as-is and are not escaped during the transfer? Or if they must be escaped, any help on a script to remove the slashes on the remote system after transfer would be nice, although not an ideal solution. It's important that the directory structure and files are identical between the two machines.