The Samba-Bugzilla – Bug 5887
RFE: --link-any-dest option considers contents only, ignores name
Last modified: 2008-11-11 06:08:57 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.
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.