Skip to main content

Kill duplicate files, finding partial files as well

Project description

https://badge.fury.io/py/killdupes.png https://travis-ci.org/numerodix/killdupes.png?branch=master https://pypip.in/wheel/killdupes/badge.png https://pypip.in/license/killdupes/badge.png

Python version support: CPython 2.6, 2.7, 3.2, 3.3, 3.4 and PyPy.

How it works

killdupes scans your filesystem to find duplicate files, partial files and empty files.

It performs n:n comparison of files through md5 hashing and heavy use of dictionaries. Execute with wildcard, or input file containing file names to check.

The method:

  1. Scan all files, find the smallest.

  2. Read read size amount of bytes (equal to the remaining size of the smallest file, or at most CHUNK size) from all files into records.

  3. Hash all records, use hashes as keys into offsets[current_offset] dict.

  4. Files in the same bucket are known to be equal up to this offset.

  5. Continue until at least two files remain that are still equal at all offsets.

  6. Equal files are either a duplicate case (if they are the same size), or one is partial relative to the other (if not the same size).

Memory consumption should not exceed files_in_bucket * read_size.

The algorithm adapts to file changes; it will read all files until eof regardless of the filesize as recorded at startup.

Installation

$ pip install killdupes

Usage

$ killdupes.py 'tests/samples/*'
Empty files:
X    0.0  B  14.03.14 17:39:48  tests/samples/empty
Incompletes:
=    2.0  B  14.03.14 18:17:43  tests/samples/full
X    1.0  B  14.03.14 18:17:26  tests/samples/partial
Duplicates:
=    2.0  B  14.03.14 18:17:43  tests/samples/full
X    2.0  B  14.03.14 18:17:37  tests/samples/full2
Kill files? (all/empty/incompletes/duplicates) [a/e/i/d/N]

If there are many files to scan it will display a progress dashboard while working:

176.1 KB | Offs   0.0  B | Buck 1/1 | File 193868/600084 | Rs   1.0  B

The dashboard fields:

  1. Total bytes read

  2. Current offset of reading

  3. Current number of buckets

  4. File/files in this bucket

  5. Readsize at this offset

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

killdupes-0.1.6.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

killdupes-0.1.6-py2.py3-none-any.whl (8.1 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file killdupes-0.1.6.tar.gz.

File metadata

  • Download URL: killdupes-0.1.6.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for killdupes-0.1.6.tar.gz
Algorithm Hash digest
SHA256 0fb441443fa23cd3087478e4b492afe2fb987a1d437a24613c6f4875a0ad0684
MD5 7803d4d074f72b782d54f08e7332384e
BLAKE2b-256 7030c9ab49a0add3006b0af4a9ee09e3143ea75496715e4893315d6f0f4ac3c0

See more details on using hashes here.

File details

Details for the file killdupes-0.1.6-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for killdupes-0.1.6-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 195ce0818e0154e69a95b802f36c19c21896c546825bd2bb47d4fa03fdcd6a49
MD5 d689e663ab1444cb8170226bafdba356
BLAKE2b-256 503bfeb2b7a08063e1ed04251a8184701654b4acdcb2e5128d26433d835111be

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page