0

I'm using scp to upload a directory to a remote server. However, if the remote server does not have a "target" directory of the same name, I get a "No such file" error.

Failed directory upload example:

$ mkdir test_local
$ touch test_local/test_local.txt
$ scp -r ./test_local user@host.edu:
> scp: realpath ./test_local: No such file
> scp: upload "./test_local": path canonicalization failed
> scp: failed to upload directory ./test_local to .

However, if I create an empty target directory on the remote machine, the command does work and successfully updates the target directory with the contents of the local directory.

It's my understanding that scp should not require an empty "target" directory of the same name to exist, so why is this the case here?

This question is not a duplicate of the question here, because the target directory (in my example, the home directory of the remote server) does exist. It simply doesn't share a name with the sent directory.

Elias
  • 29
  • 8

0 Answers0