sync two folders

Make one folder a copy of another, here or on a server, copying only what changed.

  • files
  • network

danger Steps marked in red delete, overwrite or stop something. Read each one before you run it.

Steps

  1. rsync -avn --delete src/ dest/

    danger show what would change, without changing anything

  2. rsync -av --delete src/ dest/

    danger make dest the same as src, deleting what src does not have

  3. rsync -avz src/ NAME@host:/backup/src/

    to a server, compressed on the way

  4. rsync -av --progress src/ dest/

    copy only, deleting nothing, with progress

Notes

  • --delete removes files from dest: run the -n line first.

Commands used

  • rsync

Each has a page in lore: lore rsync opens it.