Copying files using rsync from remote server to local machine

rsyncssh

Once I've ssh'd into my remote server, what would the command be to copy all files from a directory to a local directory on my machine?

Best Answer

From your local machine:

rsync -chavzP --stats user@remote.host:/path/to/copy /path/to/local/storage

From your local machine with a non standard ssh port:

rsync -chavzP -e "ssh -p $portNumber" user@remote.host:/path/to/copy /local/path

Or from the remote host, assuming you really want to work this way and your local machine is listening on SSH:

rsync -chavzP --stats /path/to/copy user@host.remoted.from:/path/to/local/storage

See man rsync for an explanation of my usual switches.