How fdupes can preserve second file

0

Can I preserve second files in list, when works with fdupes?

fpupes -N -r .

Preserve first files in list, but I need save the SECOND files. I have about 2000 duplicates and type for each 2 in prompt

fdupes -d -r .

Is to hard..

Yuchimenko Igor

Posted 2015-12-13T11:57:17.493

Reputation: 197

Answers

1

You cannot do this with fdupes. But you can use fdupes to find the dupes and remove the first one yourself like this:

fdupes -rn .|awk 'BEGIN{first=1} (first){print;first=0} /^$/{first=1}'

This will print out all the first files found by fdupes, which you then can delete with:

command | while read file
do
    rm "$file"
done

Not tested, watch out!

ctrl-d

Posted 2015-12-13T11:57:17.493

Reputation: 136

0

Use rmlint; it has heaps of options for deciding which file to delete.

thomas_d_j

Posted 2015-12-13T11:57:17.493

Reputation: 121

0

You can reverse the order in which the files are displayed with the -i option.

From the man page:

       -o --order=WORD
              order files according to WORD: time - sort by mtime, name - sort by filename

       -i --reverse
              reverse order while sorting

So for you

fdupes -N -i -r .

should work.

Björn Tantau

Posted 2015-12-13T11:57:17.493

Reputation: 103