adrianlopezroche / fdupes

FDUPES is a program for identifying or deleting duplicate files residing within specified directories.
2.42k stars 186 forks source link

Feature request: rule of selection/decision which file is duplicate #100

Open nepumuk-fs opened 6 years ago

nepumuk-fs commented 6 years ago

Normally when getting duplicates on the hard disc, it is clear for the user which of the duplicates is the original file at its desired location and which one is the redundant one. For me, it is still not obvious when fdupes considers a file as duplicate or as original.

Therefore, I suggest the feature for adding a rule (e. g. file location, various attributes, age, date of last modify) to choose which files are supposed to be deleted (or kept).

I also suggest a not-delete-option in case of doubt.

fancywriter commented 6 years ago

You probably need this option (from man)

-o --order=BY select sort order for output and deleting; by file modification time (BY='time'; default), status change time (BY='ctime'), or filename (BY='name')

But it won't help in all cases. By default results are sorted by modification time.

Suppose you want to find duplicates in two directories: ./a and ./b and you are sure that directory ./a contains originals and ./b may contain duplicates. I suggest to use touch to set modification or status change time in all files inside ./b and you can be sure that file in ./b will always be last of the duplicates, not first.

Or you probably don't need this if first directory is lexicographically before the second one. If not, you can temporary rename it (let's say first is called zzz and second is called yyy, if you call them 000zzz and 001yyy`, the should be sorted correctly).

AlexdeTaranto commented 1 year ago

I'd like to be able to choose which file is deleted by filename length. At present it always seems to be the shorter one which is preserved, but sometimes I want the more descriptive (i.e. the longer) filename to be preserved. Sorting using "-o name" (also tried "-i -o name") only changes the order of finding sets, and not the order of files chosen within a set.