Skip to content

Instantly share code, notes, and snippets.

@porcupo
Created August 8, 2016 18:47
Show Gist options
  • Select an option

  • Save porcupo/74ae55026a09b4d2e8fc08b13e61b3b1 to your computer and use it in GitHub Desktop.

Select an option

Save porcupo/74ae55026a09b4d2e8fc08b13e61b3b1 to your computer and use it in GitHub Desktop.
rsync options

rsync tidbits

useful flags for local syncing; long format used for clarity

  • --update / -u # if file exists, overwrite only if fromfile is newer than tofile
  • --archive / -a
  • --partial --progress / -P # update with deltas, show progress. can be combined as -P

useful for network syncing

  • --compress / -z

useful but optional

  • --exclude '.Trash*' # don't copy these files. Use multiple times if needed.
  • --delete # delete anything on the remote that doesn't exist locally
  • --delete-excluded # delete anything that is specified with --exclude
  • --backup # make backups of anything overwritten
  • --backup-dir ~/.rsync-backups # ...and put them here

These are kinda obsessive

  • --acls
  • --hard-links
  • --rsync-path=/usr/local/bin/rsync
  • --exclude 'Library'
  • --exclude '.serverauth*'
  • --exclude 'Google Drive'
  • --exclude 'VirtualBox VMs'

example:

rsync -uaPz --exclude '.Trash*' --delete --delete-excluded --backup \
      --backup-dir ~/.rsync-backups ~/Box Sync/ ~/box-backup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment