I try to copy files from a linux (ubuntu) machine to an external hard drive mounted on a mac but got an error message :
scp: ambiguous targetWhat I did is, I'm on a mac, ssh to the linux machine where files are. Then use the following command :
scp fileToCopy myMacUser@myMacMachine:/Volumes/MyExternalDrive/targetDirectoryWhat did I do wrong ? What is the good command to use in this case ?
13 Answers
If you have white space in a path, you have to escape the characters by using double backslashes \\ and enclosing the entire path in quotes:
scp myfile.txt user@192.168.1.100:"/file\\ path\\ with\\ spaces/myfile.txt" 8 I found that two sets of quotes worked for me, around the target location. Double quotes outside, and single quotes inside the double quotes. For example:
scp "my local file.txt" user@192.168.1.100:"'/folder/my spacey folder name/'"The outside set of quotes are for the local shell, and the inside quotes are for the remote shell. Thanks to @mik for the suggestion in comments.
1You need to put quotes so that spaces won't be misinterpreted.
Instead of doing scp file Server:/folder\ location/ you should do scp file "Server:/folder\ location/"