Categories
Uncategorized

SCP and Spaces

In using SCP to move files between machines, if the path or file has spaces in it, you’ll need to do some quoting and escaping…

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

Comments are closed.