Just a bunch of nifty
rsync tricks gathered over the years.
List all files that do not exist in
$TARGET but exist in
This one helps with previewing what will actually get synced.
rsync -avun --delete $TARGET/ $SOURCE/ | grep "^deleting "
Hardlink mirror the directory tree under
This one is really helpful when you're dealing with a random backup tool but want a generic solution for exclusion filters. Just add anything you don't want mirrored into
rsync -av --exclude-from $DATA/.rsync_ignore --link-dest=$DATA $DATA/ $DATA/.rsync_mirror
$DATA/.rsync_ignore excludes itself and the mirror directory to avoid cycles: