Spaces and SCP
Ok, so whilst trying to copy a directory structure from one of my Windows boxes at home, I had an issue getting scp to like the pathnames & filenames (they contained spaces). I’ve looked up the answer to this before as its affected me previously, but this time it took 10-15 minutes of googling. So I’m going to post it here for future reference.
scp 'user@host:/Path/Some Filename With Spaces' [destination]
I found your blog while Googling for the answer myself, but your solution doesn’t work for me. What I needed to use was:
scp user@host:"'/Path/Some Filename With Spaces'" [destination]
Note “ then ‘ (after the host) then ‘ and “ after the path.
Interestingly, neither of those worked for me, I had to do a third variation:
scp user@host:'"d:/path/some filename with spaces"' dest
where the outer single quotes protect the command line for scp to pass through the double quotes to the windows machine on the other end (which is how windows does spaces).
On linux, I found that this worked for me:
scp "user@host:/path/some\ filename\ with\ spaces" .