Bug 5887 - RFE: --link-any-dest option considers contents only, ignores name
Summary: RFE: --link-any-dest option considers contents only, ignores name
Status: NEW
Alias: None
Product: rsync
Classification: Unclassified
Component: core (show other bugs)
Version: 3.1.0
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---
Assignee: Wayne Davison
QA Contact: Rsync QA Contact
Depends on:
Reported: 2008-11-11 01:32 UTC by Dave Yost
Modified: 2008-11-11 06:08 UTC (History)
0 users

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Dave Yost 2008-11-11 01:32:20 UTC
Use case: say you have a directory full of media files on the source, and you copy them all to the destination. Now you rename some or all of the source files. You want rsync to rename the files on the destination to match the source. So you might do this:

rsync -av --delete --link-any-dest=.  .

rsync would checksum all files in the source and destination hierarchies. If a destination file is found with checksum matching the source, the link is made if the contents are identical, whether or not the filenames are identical. After this is all done, then --delete operations would take place.
Comment 1 Matt McCutchen 2008-11-11 06:08:57 UTC
The --detect-renamed option added by detect-renamed.diff does some of what you want: it scans only extraneous files in the destination directory (not another directory), and it compares only size and mtime, not contents, though the potential matches it finds are just used as basis files for delta transfers instead of being assumed to have identical contents.  Note also link-by-hash.diff.