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

Matt McCutchen matt at mattmccutchen.net
Thu Nov 12 23:53:09 MST 2009

On Fri, 2009-11-13 at 14:40 +0800, Thomas Gutzler wrote:
> Matt McCutchen wrote:
> > 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.)
> I see. That's ok though, because I'm much more interested in the case
> that a user renames a directory which contained 100G of data than the
> case that a user renames 100G worth of files.

You may be misunderstanding the options.  --detect-renamed can work
across directories, i.e., it detects renames in the sense of rename(2).
--detect-renamed-lax is a variation that accepts a destination file that
passes the quick check directly instead of just using it as a basis
(risky), and --detect-moved is a further variation that requires a
basename match (less risky).  (Wayne, I told you --detect-moved should
have been named --detect-moved-lax!)

> > 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:
> > 
> > http://lists.samba.org/archive/rsync/2007-December/019469.html
> Great. I'm running an --include='*/' --exclude='*' anyway, so I've got
> the directories.

The point is, the new destination directory has to exist when the old
destination file is considered for a rename.  Rsync might not have
created the new directory yet if it is later in the sort order or if
--detect-renamed is piggybacking on --delete-before.

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

> Any chance for a --exclude-moved-from-backup flag?

I'm not going to pursue it myself.


More information about the rsync mailing list