Haraball.no

scp a folder to or from one server

2016-09-29

To transfer a local folder to a server, run:

scp -r folder/ user@<ip-address>:/destination/path/

The folder will then end up in /destination/path/folder with all its content.

To transfer a folder from a server to your local machine, run:

scp -r user@<ip-address>:/destination/path/folder /Users/username

The folder will now end up in /Users/username/folder.

If you have set up a configuration in .ssh/config, e.g.

Host servername
 HostName <ip-address>
 PreferredAuthentications publickey
 IdentityFile ~/.ssh/id_rsa

you can transfer files with

scp -r folder/ servername:/destination/path