Skip to content

Instantly share code, notes, and snippets.

@jasemagee
Created May 30, 2015 09:52
Show Gist options
  • Save jasemagee/0595d24099a1dac886dc to your computer and use it in GitHub Desktop.
Save jasemagee/0595d24099a1dac886dc to your computer and use it in GitHub Desktop.
Rsync to backup a directory (inc. sub directories) and ignore files/folders specified in an exclude file
# Command:
alias backup='rsync -av --delete --delete-excluded --exclude-from=/path/to/exclude/file /dir/to/backup/ /dir/backup/to/'
# -a archive mode. Shortcut to a bunch of other options typically used for archives.
# -v verbose. I run the command manually and want to see what is happening.
# --delete will remove files/folders from the backup target when deleted from the backup source
# --delete-excluded will remove files/folders previously backed up that have now been marked for exclusion
# Exclude file example (ignore rule per line):
# Downloads
# .cache
# .local/share/Steam/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment