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


Jan 27, 2005 11:00 am ·

2 Comments

  1. gravatar

    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

    Comment by Robert Occhialini on Jan 27, 2005 12:54 pm


  2. gravatar

    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.

    Comment by Louis Bennett on Jan 28, 2005 12:05 pm


RSS feed for comments on this post.

Leave a comment

Sorry, the comment form is closed at this time.

Archives

photos: