Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have in a remote remote_host a file like this:

\home\user\path with spaces\filename with spaces.ext

And I want to scp it to current dir .. How can I do that?

Thanks!

share|improve this question
    
Hi, and welcome to SU. Answering your own questions is not only OK, but actively encouraged on the Stack Exchange network. Please edit your question to make it into a real question and then post your solution as an answer and accept it. –  terdon Apr 14 '13 at 20:00
    
After some investigation, I have found these two options: scp 'user@remote_host:"/home/user/path with spaces/filename with spaces.ext"' . and scp 'user@remote_host:/home/user/path\ with\ spaces/filename\ with\ spaces.ext' . I hope it helps you too! Have fun! –  Ricardo Bou Apr 14 '13 at 20:05
    
Welcome to SU. Your answer is correct but in a comment. The best you can do is to copy it to the answer section and accept it as correct. This way it can be upvoted so you earn reputation and people with the same problem will have an indication that your answer works and how many people found it helpful. –  laurent Apr 14 '13 at 20:31
    
Afte terdon comment, I triend to Answer my own question, but I was not allowed: I had to wait 8 hours to do it because I am a new user. –  Ricardo Bou Apr 15 '13 at 6:32

2 Answers 2

up vote 5 down vote accepted

After some investigation, I have found these two options:

scp 'user@remote_host:"/home/user/path with spaces/filename with spaces.ext"' .

and

scp 'user@remote_host:/home/user/path\ with\ spaces/filename\ with\ spaces.ext' .

I hope it helps you too!

Have fun!

share|improve this answer

You have two options.

Option one: enter spaces as "\ ". Example; /home/matthew/File\ With\ Spaces.file.

Option two: enter the path in apostrophes single quotes like so: '/home/matthew/File With Spaces.file'.

If you use tabulator key (Tab) to auto-complete the file name, it will insert "\ " automatically, however you need to be using public key authentication for it to work on a remote host.

share|improve this answer
    
Technically, those a single quotes, not apostrophes. It's the same character in ASCII, but the term apostrophe has English grammatical implications that don't apply here. –  depquid Apr 14 '13 at 20:53
    
Thanks, I was going to call it a quote but didn't want to cause any confusion. I'll remember "single quote" next time. –  Nysepho Apr 14 '13 at 20:54
1  
I am sorry, that is not working. It is necessary to combine single quotes with backslashes or double quotes. Tab did not work for me either. –  Ricardo Bou Apr 15 '13 at 6:33

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.