2005.01.27

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 Responses to “SCP and Spaces”

  1. 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

  2. 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.

« | »


buy the button:

Buy The Button