Tuesday, July 7, 2015

RSYNC escaping local filenames to deal with "The source and destination cannot both be remote."

I was having issues rsyncing a local file to a remote web server, I'm assuming it was because there was colons in the filename of the local file.

I tried single quotes and double quotes to escape it, and backslashes to escape the colons manually, none of which worked alone or together.

After a little googling, I came up with trying the ./ in front of the file, mixed with the manual escaping of each colon using backslashes, this worked!

rsync -aP ./mysql.servername.com.sql.2015-07-04T02\:45\:59Z.gz 'root@servername.com:/root/backups/'

Figured I would share it as I had to go through a couple articles (and actually found it in the comments of an article).