Was ist die beste Methode, um doppelte Bilddateien von Ihrem Computer zu entfernen?

4899
BioGeek

Ich habe viele doppelte Bilddateien auf meinem Windows-Computer, in verschiedenen Unterordnern und mit unterschiedlichen Dateinamen.

Welches Python-Skript oder Freeware-Programm würden Sie zum Entfernen der Duplikate empfehlen?

(Ich habe diese ähnliche Frage gelesen, aber das Poster dort fragt nach visuellen Duplikaten mit unterschiedlichen Dateigrößen. Meine sind exakte Duplikate mit unterschiedlichen Dateinamen.)

14
Beachten Sie, dass selbst wenn alle Pixel gleich sind, sie möglicherweise noch andere EXIF-Informationen haben (die von Programmen geändert wurden, die die Bilder zu einem bestimmten Zeitpunkt bearbeitet haben), was bei den meisten derzeit vorgeschlagenen Lösungen Probleme aufwirft. user12889 vor 13 Jahren 2

6 Antworten auf die Frage

17
Kent Fredric

Don't Rely on MD5 sums.

MD5 sums are not a reliable way to check for duplicates, they are only a way to check for differences.

Use MD5s to find possible candidate duplicates, and then for each pair sharing an MD5

  1. Opens both files
  2. Seeks forward in those files until one differs.

Seeing I'm getting downvoted by people doing naïve approaches to file duplicate Identity, If you're going to rely entirely on a hash algorithm, for goodness sake, use something tougher like SHA256 or SHA512, at least you'll reduce the probability to a reasonable degree by having more bits checked. MD5 is Exceedingly weak for collision conditions.

I also advise people read mailing lists here titled 'file check' : http://london.pm.org/pipermail/london.pm/Week-of-Mon-20080714/thread.html

If you say "MD5 can uniquely identify all files uniquely" then you have a logic error.

Given a range of values, of varying lengths from 40,000 bytes in length to 100,000,000,000 bytes in length, the total number of combinations available to that range greatly exceeds the possible number of values represented by MD5, weighing in at a mere 128 bits of length.

Represent 2^100,000,000,000 combinations with only 2^128 combinations? I don't think that likely.

The Least Naïve way

The least naïve way, and the fastest way, to weed out duplicates is as follows.

  1. By size: Files with different size cannot be identical. This takes little time as it does not have to even open the file.
  2. By MD5 : Files with different MD5/Sha values cannot be identical. This takes a little longer because it has to read all bytes in the file and perform math on them, but it makes multiple comparisons quicker.
  3. Failing the above differences: Perform a byte-by-byte comparison of the files. This is a slow test to execute, which is why it is left until after all the other eliminating factors have been considered.

Fdupes does this. And you should use software that uses the same criteria.

Es ist buchstäblich wahrscheinlicher, dass Ihre Festplatte ein Image auf magische Weise zerstört, als dass MD5 kollidiert. "Stellen Sie 2 ^ 100.000.000.000 Kombinationen mit nur 2 ^ 128 Kombinationen" - ich stimme Ihnen hier zu. Wenn er 2 ^ 100.000.000.000 Bilder hätte, wäre MD5 (oder fast jeder Hash-Algorithmus) schlecht. Greg Dean vor 15 Jahren 7
Es gibt * keine * Garantie, es ist nur * unwahrscheinlich *. Es ist nicht unmöglich. Es ist durchaus möglich, 10 Dateien zu haben, die alle miteinander kollidieren, jedoch völlig verschieden sind. Dies ist unwahrscheinlich, kann jedoch vorkommen, deshalb müssen Sie es testen. Kent Fredric vor 15 Jahren 4
Dateigröße, dann MD5 und erst dann Byte für Byteprüfung. Brad Gilbert vor 15 Jahren 2
@ Kent - Ich bin zu 100% mit dir einverstanden. Es ist Faulheit, etwas außer Acht zu lassen, weil es sehr unwahrscheinlich ist, selbst wenn es so unwahrscheinlich ist, wie wir darüber sprechen. Ich wäre ärgerlich, wenn einige meiner Daten zerstört würden, nur weil die Person, die das Programm geschrieben hat, der Meinung ist, dass etwas zu unwahrscheinlich ist, um das Programmieren zu stören. Joe Taylor vor 13 Jahren 3
10

It's a one liner on unix like (including linux) OSes or Windows with Cygwin installed:

find . -type f -print0 | xargs -0 shasum | sort | perl -ne '$sig=substr($_, 0, 40); $file=substr($_, 42); \ unlink $file if $sig eq $prev; $prev = $sig' 

md5sum (which is about 50% faster) can be used if you know there is no deliberately created collisions (you'd have better chance to win 10 major lotteries than the chance to find one naturally occurring md5 collision.)

If you want to see all the dups you have instead of removing them just change the unlink $file part to print $file, "\n".

Sie können auch -print0 und xargs-0 verwenden, um Leerzeichen abzufangen. Find hat jedoch auch die Option -exec, die hier nützlich ist: find. -type -exec shasum {} \; | sort ... Außerdem sollten Sie @F (-a) nicht verwenden, da dies nicht mit Leerzeichen funktioniert. Versuchen Sie stattdessen substr. vor 15 Jahren 1
Guter Anruf, Geocar. Aktualisieren Sie die Antwort mit Ihren Vorschlägen. vor 15 Jahren 0
"md5sum (das ist etwa 50% schneller) kann verwendet werden, wenn Sie wissen, dass es keine bewusst verursachten Kollisionen gibt" - genau Greg Dean vor 15 Jahren 0
6
ShreevatsaR

I've used fdupes (written in C) and freedups (Perl) on Unix systems, and they might work on Windows as well; there are also similar ones that are claimed to work on Windows: dupmerge, liten (written in Python), etc.

Perl- und Python-Software sollte auf Windows- und * nix-Systemen identisch funktionieren, vorausgesetzt, dass Details des Dateisystems keine Rolle spielen. CarlF vor 13 Jahren 0
2
Sean

To remove duplicate images on Windows take a look at DupliFinder. It can compare pictures by a variety of criteria such as name, size, and actual image information.

For other tools to remove duplicate files take a look at this Lifehacker article.

1

Instead of DupliFinder, try the forked project instead, DeadRinger. We've fixed a ton of bugs in the original project, added a bunch of new features, and dramatically improved performance.

1
jhamu

Eine Option kann Dupkiller sein .

DupKiller ist eines der schnellsten und leistungsfähigsten Werkzeuge zum Suchen und Entfernen von doppelten oder ähnlichen Dateien auf Ihrem Computer. Komplizierte, in den Suchmechanismus eingebaute Algorithmen führen zu hohen Ergebnissen - schnelle Dateisuche. Viele Optionen ermöglichen eine flexible Anpassung der Suche.