--link-dest but only if rsync detects differences

Daniel Jarboe daniel.ml.spam at gmail.com
Thu Nov 13 21:17:30 GMT 2008


I'm currently using rsync and --link-dest to give me something like a
poor-man's incremental snapshot to disk.  But I really only want to generate
a new backup if rsync detects differences, otherwise I don't need a new
backup.

Currently I do something like this:

rsync -a --delete --link-dest=../backup.previous/  source/ backup.next/
diff -r backup.previous backup.next && rm -r backup.next

Is there a way to tell rsync to not even bother creating backup.next if
there are no differences?  It looks like --compare-dest will also recreate
the directory structure when there are no differences.  The closest I can
come up with other than cleaning up after the fact is first running rsync
with -n --stats and conditionally running rsync again if the output from the
first run indicates new files (which doesn't account for deletions).  It
seems there should be a better/cleaner way but I haven't found it from the
man pages.  I'm currently using rsync 2.6.9.

Is it possible to make rsync perform --link-dest if and only if it detects
differences?

Thanks for any guidance,
~ Daniel
-------------- next part --------------
HTML attachment scrubbed and removed


More information about the rsync mailing list