Question

I've been trying to learn how to ftp through the command line.

I've tried these but am having some minor issues:

$ cd path/to/parent/of/local_directory
$ scp -r local_directory username@74.212.212.222:/absolute/path/to/remote_directory

This seems to get the files up there, but it's dumping the local_directory into the remote_directory.

ie:

$ ssh username@domain.com    // assuming you signed it alright
$ cd path/to/remote_directory
$ ls
./ ../ index.html local_directory

I don't want to dump the directory in there, I want to update the files & directories inside the remote_directory. How do I get this to work correctly? I believe it has something to do with the /'s after the directory names but I'm not quite sure which should go where.

Était-ce utile?

La solution

You're telling it to copy the directory. If you just want to copy the files, add /* to the source param:

scp -r local_directory/* username@74.212.212.222:/absolute/path/to/remote_directory
# Here ---------------^^

Autres conseils

With that you are copying the folder, what you need to copy are the folder contents, have you tried this?

scp -r local_directory/* username@74.212.212.222:/absolute/path/to/remote_directory

scp works like the cp command. The correct scp command would be :

scp -r local_directory/* username@74.212.212.222:/absolute/path/to/remote_directory

This copies the local_directory content into the /absolute/path/to/remote_directory

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top