It is possible to use secure copy (scp) with the recursive option (-r) to transfer files/folders, for example, to move files from Desktop to the remote host/server:
- scp -r /path/to/local/dir user@remotehost:/path/to/remote/dir
or from the remote host to the Desktop:
- scp -r user@remotehost:/path/to/remote/dir /path/to/local/dir
But using rsync is very powerful because it enables you to resume transfers if the connection breaks accidentally, and it intelligently transfers only the differences between files. Therefore, we can use rsync to move files from local directory on the Desktop to the remote server as:
- rsync -avz -e 'ssh' /path/to/local/dir user@remotehost:/path/to/remote/dir
or do vice versa:
- rsync -avz -e 'ssh' user@remotehost:/path/to/remote/dir /path/to/local/dir
Note that in both cases be careful of trailing slashes: moving /path/to/local/dir to remote host /path/to/remote/dir/ results in /path/to/remote/dir/dir.