views:

109

answers:

2

Source directory is determined like so:

SHOW=${PWD##*/}
[email protected]:"/mnt/bigfish/video/TV/${SHOW}/"

So it comes out something like:

[email protected]:/mnt/bigfish/video/TV/The Name Of the Show With Spaces/

Then trying to run rsync like so:

rsync -avz -e ssh "${SRC}" .

But it tells me that ""/mnt/bigfish/video/TV/The" is not a directory, ""/mnt/bigfish/video/TV/Name" is not a directory, etc, for however many space-delimited words are in the name of the source directory.

How can I rectify this egregiously annoying issue?

UPDATE I'm running this on OS 10.6, and I ended up string-replacing spaces with escaped spaces like so:

[email protected]:"/mnt/bigfish/video/TV/${SHOW// /\ }/"
+2  A: 

From the rsync manual:

-s, --protect-args
This option sends all filenames and most options to the remote rsync without allowing the remote shell to interpret them. This means that spaces are not split in names, and any non-wildcard special characters are not translated (such as ~, $, ;, &, etc.). Wildcards are expanded on the remote host by rsync (instead of the shell doing it).

msw
There is no such option in the Darwin 10.4 build of rsync in Snow Leopard.
Wells
+1 Definitely sounds more reasonable than my thought
David Zaslavsky
@wells: then you should probably get a version more current than the six year old one that Apple decided to ship you: http://developer.apple.com/mac/library/documentation/Darwin/Reference/ManPages/10.4/man1/rsync.1.html?useVersion=10.4
msw
Don't you sass me.
Wells
@msw: Sass him some more
Matt Joiner
+1  A: 

This works:

rsync -avz -e ssh "[email protected]:\"/mnt/bigfish/video/TV/${SHOW}/\""

So set:

[email protected]:\"/mnt/bigfish/video/TV/${SHOW}/\"

At least, here on Debian it works like a charm, no OS 10 available to test with here.

Wrikken
Yeah, -s and manual escaping are the recommended workarounds. From the manual: "If you need to transfer a filename that contains whitespace, you can either specify the --protect-args (-s) option, or you’ll need to escape the whitespace in a way that the remote shell will understand."
tokland