Copy files with rsync over SSH

Like scp, but it only sends what changed, and it can resume.

SNP 047 #459 Filed cmd ssh linux

shell
rsync -avz --progress ./dist/ web:/var/www/site/
  • a: archive, keeps permissions, times and symlinks
  • v: verbose
  • z: compress on the wire
  • --progress: show what it's doing

Mind the trailing slash on the source. dist/ copies the contents of dist, dist copies the folder itself.

Add --delete to remove files on the target that no longer exist locally, which is what you want for deploying a static site. Run it with --dry-run first the first time.