Question

How can I copy a folder and its contents (folders inside too), from my local machine to a remote machine using SCP.

I want to copy:

/wp-content

to my remote server, but wp-content does not exist there.

Était-ce utile?

La solution

I would tar the folder first and then send over scp

first tar

tar -zcvf wp-content.tar.gz ./wp-content

then send over scp

scp ./wp-content.tar.gz your_username@remotehost.com:/some/remote/directory

then login to the remote machine

ssh your_username@remotehost.com

Navigate to the directory and untar

cd /some/remote/directory
tar -xzvf wp-content.tar.gz ./

Autres conseils

rsync -ave ssh /wp-conent user@server_ip:/path/some_non_existing_dir_to_copy/

scp -r wp-content user@remotehost:/destination

scp -r (recursive copy) will create the destination folder if it's not there already.

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