--detect-renamed --detect-moved and -b

Matt McCutchen matt at mattmccutchen.net
Thu Nov 12 22:47:36 MST 2009

On Wed, 2009-11-11 at 20:27 +0800, Thomas Gutzler wrote:
> I played around with the combination of rsync --detect-renamed
> --detect-moved and -b.

You can't combine the --detect-renamed and --detect-moved options
because they make use of the partial dir in incompatible ways.  The last
option on the command line takes priority.  (Yes, the implementation of
--detect-moved is a hack.  No, I don't care to improve it myself.)

> Given the following tree:
> src/dir/file
> dest/src/dir/file
> I renamed src/dir to src/dir2 and ran the following command:
> rsync -a --detect-renamed --detect-moved --delete -b --backup-dir=bak src dest
> ending up with:
> dest/bak/src/dir/file
> Is it supposed to do that? I was expecting it to detect the renamed
> directory (or moved file) and exclude it from the backup.

Yes, the current design is that a deleted destination file is backed up
even if it was also detected as a rename.

In addition, your case tickles an awkward-to-fix bug in the
--detect-renamed implementation: renames into new directories are not
processed because their partial dirs are not available yet.  See:



More information about the rsync mailing list