When you need to copy file from one server to another SCP is a great tool, you can use it to either push or pull content, and this transfer is done via the SSH protocol which is typically open on all linux servers.

The reason why I mentioned push or pull is because if you have a server that doesn’t have an ssh server installed, you can still pull the content so long as the other server has an ssh server installed, even if it’s light weight dropbear.

Sytanx is fairly simple, the following will login to a remote ssh box and copy files to the local destination

scp user@hostname:/source-files /destination-files

Where as this command will copy some local files to the remote destination.

scp  /source-files user@hostname:/destination-files

However what if you want to copy more than one directory? simple you just need to add the recursive flag “-r”, a working example below:

scp -r* /var/www/whatportis/

Just enter the password when prompted!

You can leave a response, or trackback from your own site.

Leave a Reply

Our Sponsors