SCP and path with spaces? (another "waste of time issue")

Sometimes, you need to deal with a really time-wasting issue. I think it happens even more often if you work in the IT industry. You know the resolution must be simple, but all your attempts failed. So you try to search the web, looking for a plain sentence that will lead you out of that mess...

If you want to copy a file using SCP and the remote path contains spaces, you do it this way:

scp -r username@servername:"/some/path\\\\ with\\\\ spaces" .

Everything you need to do is to enclose the path in double quotes and use double backslash on spaces...

Comments:

For completeness, note that you can also use triple \\\\\\ without quotes, or if you are using a good shell like zsh you can press TAB and let completion do the job.

Posted by Marc on March 27, 2009 at 03:34 AM PDT #

Thanks, was wondering for ages how to get that to work.

-Death

Posted by TheDeath on December 14, 2010 at 06:23 AM PST #

A single backslash and no quotes work just fine for me.

Posted by orion on December 25, 2010 at 01:28 PM PST #

Post a Comment:
Comments are closed for this entry.
Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today