Skip to main content

similar-files

Find files that are the same, or that look the same, and get each group as a playlist you can open anywhere.

Status: early development. The command line and the library may still change between releases.

What it finds

  • Identical files: the same bytes under different names or in different folders. Needs nothing beyond Python.
  • Similar images: the same picture resized, re-encoded or lightly edited. Uses an optional dependency.
  • Similar videos: the same video re-encoded, resized or re-muxed, and clips cut out of a longer video. Needs ffmpeg on your PATH.
  • Similar audio: the same recording re-encoded or re-tagged, an excerpt and the recording it was cut from, a track inside a longer mix. Needs fpcalc from Chromaprint on your PATH (brew install chromaprint, apt install libchromaprint-tools).

Content-aware matching ("screenshots of receipts") is planned for later.

How it works

pip install similar-files    # with Pillow (similar images) and numpy (fast video grouping)

similar-files scan ~/Pictures --out ~/similar-groups              # identical files
similar-files scan ~/Pictures --out ~/similar-images -m image     # similar images
similar-files scan ~/Movies --out ~/similar-videos -m video       # similar videos
similar-files scan ~/Music --out ~/similar-music -m audio         # similar audio
similar-files scan ~/Pictures --out ~/copies -r ~/Desktop/logo.png  # copies of one file

From a checkout, run python -m similar_files instead of similar-files. --threshold (0–1) sets how close a match must be, and similar-files extractors lists what can be compared.

Each group becomes one .m3u8 playlist in the output folder, and its first line is the file the others were compared with:

~/similar-groups/
  IMG_0012.jpg (3).m3u8
  logo_final.png (2).m3u8

M3U is a plain, widely supported list format, so you review a group in whatever tool you like: a media player, XeFM (press Enter on a playlist to see its files in a pane and copy, move or delete them there), or a text editor.

Two guarantees:

  • similar-files never deletes, moves or changes your files. It only reads them, and you decide what to keep.
  • It writes nothing next to your files. Features it computes are cached in your user cache folder, so a second scan is fast. You can delete that cache at any time.

Watching a scan from another program

A long scan does not need anyone to stay attached to it. Start it with --status FILE, and it keeps its progress in that file as JSON (replaced whole each time, and rewritten every few seconds while it runs). Create the file named by --stop-file FILE to stop it the way Ctrl-C does: the groups found so far are still written.

similar-files scan ~/Movies --out ~/groups -m video \
    --status ~/scan/status.json --stop-file ~/scan/stop

Add --format tree and --out names one .xft file instead of a folder. It holds every group, and it is rewritten every few minutes while the scan runs, so you can start looking before the scan ends. Those intermediate groups are provisional: a file read later can still join one, or start a new group. The last write is final. XeFM opens this file the way it opens an archive.

XeFM starts scans this way, so they keep running after you close it. See doc/STATUS_FORMAT.md.

Using it from Python

The command line is a thin wrapper. The scanning, caching and grouping are a library that other programs can call, and XeFM is the first program to use it. See doc/LIBRARY.md, and for the formats other programs read, doc/PLAYLIST_FORMAT.md and doc/CACHE.md.

License

MIT. See LICENSE.

Metadata

Release files for similar-files 0.5.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for similar-files 0.5.1
File Size Uploaded Provenance Actions
similar_files-0.5.1.tar.gz 73.4 kB Without provenance Details for similar_files-0.5.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for similar-files 0.5.1
File Interpreter ABI Platform Actions
similar_files-0.5.1-py3-none-any.whl Python 3 none any Details for similar_files-0.5.1-py3-none-any.whl

Total release size: 131.3 kB

Release files / similar_files-0.5.1.tar.gz

Download URL similar_files-0.5.1.tar.gz
Size 73.4 kB
Tags Source
SHA-256 checksum
How to use checksums
8040780cd582c456b103b40360fbe313cc13449c7d2a0a7a3f06ec49d2c487ab
BLAKE2b-256 checksum
How to use checksums
5f321d009fad0ecbf7a2e751d19474519b33f1875afdc0e7a9495850f06fb45d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / similar_files-0.5.1-py3-none-any.whl

Download URL similar_files-0.5.1-py3-none-any.whl
Size 57.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
db3ada558c83ea5d6ce82ed4e165242fbd0e604b914cf587b96a085fcbc19ca8
BLAKE2b-256 checksum
How to use checksums
5cbe4ebc92ff048d96b5d829d649e0a76b4ca7afd80f43c6b44f5d9a384e6950
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Security for similar-files 0.5.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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page