Backups & Directory Timestamps Not Preserved

Robert Boucher rboucher at cox.net
Sun Aug 2 19:50:58 MDT 2009


Hello,

I've been testing out using rsync for nightly incremental backups
through the '--backup' & '--backup-dir' options. So far, I've noticed
two issues.

1) First, if an empty directory is removed from the source, rsync will
remove it from the destination but not create the directory in the
backup-dir location.

  $ mkdir -p /tmp/src/foo
  $ rsync -a /tmp/src/ /tmp/dest/
  $ rmdir /tmp/src/foo
  $ rsync -a --delete -P -b --backup-dir=/tmp/desti/ /tmp/src/ /tmp/dest/

2) Second, when the contents of a non-empty directory is modified, the
original timestamp is not preserved in the backup-dir location.

  $ mkdir -p /tmp/src/foo
  $ touch -t 200904011200 /tmp/src/foo/bar /tmp/src/foo /tmp/src
  $ rsync -a /tmp/src/ /tmp/dest/
  $ rm -rf /tmp/src/foo/bar
  $ rsync -a --delete -P -b --backup-dir=/tmp/desti/ /tmp/src/ /tmp/dest/
  $ ls -ald /tmp/desti/foo /tmp/desti/foo/bar

I'm using version 3.0.6. I've played around with various options but did
not find a combination where this worked. I scanned through the source,
and it appears as though rsync only creates directories as required by
files when they are moved over and doesn't update the timestamps after
the directory's contents are processed. Is this accurate or is there
some combination which will allow this to work?

-Rob



More information about the rsync mailing list