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!
filenamesscp
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!
Best Answer
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!
Edit - openssh was updated with a security feature that causes, with certain characters in the path name, an error message "protocol error: filename does not match request". In that case using scp's new
-T
option will allow it to work. for examplescp -T 'user@remote_host:"/home/user/path with spaces/filename with spaces and (2018).ext"' .
This is explained in https://stackoverflow.com/a/54599326