Copy files/folders over ssh

Sometimes you just want to copy files from a remote server, and you want it often and quick. Stuff like a DB dump or the whole uploads folder.
You could startup your (s)ftp client and browse to it. Or you could just grab it with ssh.

Download one file

rsync -rvz --progress user@server:/var/www/ ~/Downloads

To upload flip the source and destination

rsync -rvz --progress ~/Downloads/uploads.tar.gz user@server:/var/www/ 

Download a whole folder

scp -r [email protected]:/full/path/to/folder /local/path/to/Downloads

Alternate ports

Sometimes the remote server had alternate ssh ports.

  • On rsync: -e 'ssh -p 2223'
  • on csp: -P 2223