I want to delete duplicates only if files share the same name.
Something like: rdfind -deleteduplicates true ~/folder
will not accomplish my objective.
One idea could be to get the output (results.txt) of rdfind of a dry-run,
rdfind -n true "$PWD"
and determine which files have the same name of the 1st one of each group, identified by beginning with: DUPTYPE_FIRST_OCCURRENCE XXXX
DUPTYPE_FIRST_OCCURRENCE 5148 2 37934240 2054 16916792 1 /home/fig3.tif
DUPTYPE_WITHIN_SAME_TREE -5148 3 37934240 2054 17044654 1 /home/other/fig3.tif
DUPTYPE_WITHIN_SAME_TREE -5148 3 35435435 2054 16546546 1 /home/other2/fig3.tif
DUPTYPE_FIRST_OCCURRENCE 5160 2 116397930 2054 16916804 1 /home/file.psd
DUPTYPE_WITHIN_SAME_TREE -5160 2 116397930 2054 16916870 1 /home/folder/file.psd
DUPTYPE_WITHIN_SAME_TREE -5160 2 116397930 2054 17654654 1 /home/folder/file2.psd
In the example above, for the 1st group 2 duplicates should be removed, while in the 2nd group only one should be removed, which has the same name as the First occurrence (file.psd).
EDIT: An answer for rmlint would be desirable. Establishing the "original" file customarily is possible with rmlint