In using SCP to move files between machines, if the path or file has spaces in it, this will not work:
scp foo.com:/home/fubar/some\ folder/file.txt ./
And neither will this:
scp foo.com:"/home/fubar/some folder/file.txt" ./
But this will:
scp foo.com:"/home/fubar/some\ folder/file.txt" ./
So be sure to use double quotes to enclose the path and escape the spaces with a backslash.
orjustdontuseanyspacesatallever
2 replies on “SCP and Spaces”
Another scp thingee, which I am constantly surprised to find out people don’t seem to know is that you can transmit files to boxes as a specific user on that box by using the following syntax:
scp filename username@hostname:targetpath
I ran into this the other day. This works, too:
scp foo.com:/home/fubar/some\ folder/file.txt ./
Seems like you have to escape the backslash and the space.