SCP gives "File or directory not found"
To send a file from the local host to another server use:
scp /path/to/file.doc user@<IP or hostname>:/path/to/where/it/should/go/
To get a file from another server to the local host use:
scp user@<IP or hostname>:/path/to/file.doc /path/to/where/it/should/go/
This is the format I reliably use for copying from a location to another location. You can use absolute path, or relative/special character path, such as
scp suiterdev@fakeserver:~/folder/file .
which would be "Securely copy the file named file
in $HOME/folder/
(~
equivalent to ~suiterdev
or $HOME
) as user suiterdev
from host fakeserver
to the current directory (.
).
However you'll have to take care that special characters (see the shell's filename expansion mechanism) used for the remote path are not expanded locally (because that typically is not what you want).
Well for me am using Ubuntu 15.10 and this is what worked for me.
scp user@host.com:path/to/file.txt /home/to/local/folder/
instead of
scp user@host.com:/path/to/file.txt /home/to/local/folder/
Note that after user@host.com host i do not include the forward slash i immediately append the folder after the ":"
Scp uses the target user's home directory as default directory (as a relative path), so when you need an absolute path, then use one (starting with a slash (/
)).
I know this is way too late for this to help you, but it may help others who had the same problem as mefor my case my pc is set up to use backwards slash "\"
instead of forward slash "/"
and changing to backwards slashes removed the errors
But I only had to change the slashes to backward slashes on my pc's directory as my raspberry pi uses forward slashes.
I know it is a bit confusing but it worked for me.