rsync with spaces and single quotes in remote path

I know how to use rsync when there are spaces in the remote path. Put single quotes around it and slash the spaces. Like this:
Code:
rsync 'user@host.domain.com:/path\ with\ spaces/' /path/to/destination/
But what if the remote path also has a single quote in directory name?
 
If you put quotes around it you don't have to escape the spaces. You need to escape them if there were no quotes.

[cmd=]rsync [email='user@host.domain.com]'user@host.domain.com[/email]:/path with spaces/' /path/to/destination/[/cmd]

A single quote would need to be escaped, or you can use double quotes.

[cmd=]rsync [email='user@host.domain.com]'user@host.domain.com[/email]:/path with a \'/' /path/to/destination/[/cmd]
[cmd=]rsync "user@host.domain.com:/path with a '/" /path/to/destination/[/cmd]
 
Never mind, I figured it out. Put double quotes around it! I had already tried that, but it didn't work. But it turned out to be a typo, that caused the errors I got ;)

Edit: thanks for the effort SirDice :)
 
Back
Top