pydupes is yet another duplicate file finder like rdfind/fdupes et al
that may be faster in environments with millions of files and terabytes
of data or over high latency filesystems (e.g. NFS).
The algorithm is similar to rdfind with threading and consolidation of filtering logic (instead of separate passes).
- traverse the input paths, collecting the inodes and file sizes
- for each set of files with the same size:
- further split by matching 4KB on beginning/ends of files
- for each non-unique (by size, boundaries) candidate set, compute the sha256 and emit pairs with matching hash
Constraints:
- traversals do not span multiple devices
- symlink following not implemented
- concurrent modification of a traversed directory could produce false duplicate pairs (modification after hash computation)
Setup
# via pip
pip3 install --user --upgrade pydupes
# or simply if pipx installed:
pipx run pydupes --help
Usage
# Collect counts and stage the duplicate files, null-delimited source-target pairs:
pydupes /path1 /path2 --progress --output dupes.txt
# Sanity check a hardlinking of all matches:
xargs -0 -n2 echo ln --force --verbose < dupes.txt
Benchmarks
Hardware is a 6 spinning disk RAID5 ext4 with
250GB memory, Ubuntu 18.04. Peak memory and runtimes via:
/usr/bin/time -v.
Dataset 1:
- Directories: ~33k
- Files: ~14 million, 1 million duplicate
- Total size: ~11TB, 300GB duplicate
pydupes
- Elapsed (wall clock) time (h:mm:ss or m:ss): 39:04.73
- Maximum resident set size (kbytes): 3356936 (~3GB)
INFO:pydupes:Traversing input paths: ['/raid/erik']
INFO:pydupes:Traversal time: 209.6s
INFO:pydupes:Cursory file count: 14416742 (10.9TiB), excluding symlinks and dupe inodes
INFO:pydupes:Directory count: 33376
INFO:pydupes:Number of candidate groups: 720263
INFO:pydupes:Size filter reduced file count to: 14114518 (7.3TiB)
INFO:pydupes:Comparison time: 2134.6s
INFO:pydupes:Total time elapsed: 2344.2s
INFO:pydupes:Number of duplicate files: 936948
INFO:pydupes:Size of duplicate content: 304.1GiB
rdfind
- Elapsed (wall clock) time (h:mm:ss or m:ss): 1:57:20
- Maximum resident set size (kbytes): 3636396 (~3GB)
Now scanning "/raid/erik", found 14419182 files.
Now have 14419182 files in total.
Removed 44 files due to nonunique device and inode.
Now removing files with zero size from list...removed 2396 files
Total size is 11961280180699 bytes or 11 TiB
Now sorting on size:removed 301978 files due to unique sizes from list.14114764 files left.
Now eliminating candidates based on first bytes:removed 8678999 files from list.5435765 files left.
Now eliminating candidates based on last bytes:removed 3633992 files from list.1801773 files left.
Now eliminating candidates based on md5 checksum:removed 158638 files from list.1643135 files left.
It seems like you have 1643135 files that are not unique
Totally, 304 GiB can be reduced.
fdupes
Note that this isn't a fair comparison since fdupes additionally performs a byte-by-byte comparison on MD5 match. Invocation with "fdupes --size --summarize --recurse --quiet".
- Elapsed (wall clock) time (h:mm:ss or m:ss): 2:58:32
- Maximum resident set size (kbytes): 3649420 (~3GB)
939588 duplicate files (in 705943 sets), occupying 326547.7 megabytes
Metadata
Release files for pydupes 0.6.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pydupes-0.6.1.tar.gz | 9.5 kB | Without provenance | Details for pydupes-0.6.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pydupes-0.6.1-py3-none-any.whl | Python 3 | none | any | Details for pydupes-0.6.1-py3-none-any.whl |
Total release size: 18.7 kB
Release files / pydupes-0.6.1.tar.gz
| Download URL | pydupes-0.6.1.tar.gz |
|---|---|
| Size | 9.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c235f1439561047317a7d0ec780cbd2181bd1d66e0f5382ecc255def57bf7d42
|
|
BLAKE2b-256 checksum How to use checksums |
e362bd1c0b51e0081399eab63d66c640f274a19c6d44cec2b9ba28b81260d722
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.11 CPython/3.9.1 Linux/5.4.151-16908-gff376e5d5ee1
|
Release files / pydupes-0.6.1-py3-none-any.whl
| Download URL | pydupes-0.6.1-py3-none-any.whl |
|---|---|
| Size | 9.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bffd9c3048cd9ccec542b8263bef0901212df77685878cb230fa6f2dede16554
|
|
BLAKE2b-256 checksum How to use checksums |
139bb434a0f8c9f2e2cac40b20586d6362c981c122a4a2017d0be8a95b210145
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.11 CPython/3.9.1 Linux/5.4.151-16908-gff376e5d5ee1
|
Security for pydupes 0.6.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.