Skip to main content

Two- or three-way comparison tool for files and directories

Project description

triplecheck

PyPI Version OS Ruff ty CI codecov

triplecheck is a two- and three-way file and directory comparison tool:

  • For files it compares their hashes.
  • For directories, it either compares the hashes of every file (full comparison mode), or compares file names and sizes (default). And it contains an optional -i flag to ignore folder structure and focus exclusively on files (useful if directories have been nested, moved around or renamed in one of your copies).

Two hash functions are available: xxhash for high-throughput and blake3 for cryptographic hashing.

🚀 Installation

  1. Install the uv package manager with the official installer, or:
  • macOS: brew install uv
  • Windows: winget install astral-sh.uv
  • Linux (Debian): apt-get install uv
  1. Install the tool:
uv tool install triplecheck
  1. Test the installation (if the command is not recognised try uv tool update-shell and restart Terminal):
triplecheck --version

📖 Usage examples

Compare two files:

triplecheck "path/to/file1" "path/to/file2"

Compare two (or three) directories:

triplecheck "path/to/dir1" "path/to/dir2" "path/to/dir3"            # metadata-only comparison (filenames and file sizes)
triplecheck -f "path/to/dir1" "path/to/dir2"                        # full  comparison: hash every file
triplecheck -i "path/to/dir1" "path/to/dir2"                        # ignore folder structure
triplecheck -e "*.mhl" -e "*.txt" "path/to/dir1" "path/to/dir2"     # exclude .mhl and .txt files

Compare two (or three) directories on different machines:

triplecheck --molist "path/to/local/dir1"                           # creates "molist_dir1.tsv"
triplecheck --molist "path/to/remote/dir2"                          # creates "molist_dir2.tsv"
triplecheck --mocompare "molist_dir1.tsv" "molist_dir2.tsv"

Check that the destination contains all of the files from the source

triplecheck --diff "path/to/src" "path/to/dst" | grep "<"

Output is composed of pairs or triads representing the relationship between the paths (<, > and >> represent the paths provided). In the example below IMG_0421.mov exists only in PRJ_MST01, while IMG_0422.mov exists everywhere but the copy on PRJ_BAK02 is different to the others.

$ triplecheck /Volumes/PRJ_MST01 /Volumes/PRJ_BAK01 /Volumes/PRJ_BAK02
<  ∃ IMG_0421.mov
>  ∄ IMG_0421.mov
>> ∄ IMG_0421.mov

<  = IMG_0422.mov
>  = IMG_0422.mov
>> ≠ IMG_0422.mov

Two-way comparison with --diff offers an alternative output format for those familiar with diff. Lines starting with < are unique to the first path, > lines are unique to the second path:

$ triplecheck --diff /Volumes/PRJ_MST01 /Volumes/PRJ_BAK01
< IMG_0421.mov
> IMG_0422.mov

Run triplecheck --help to see the full list of options.

🤝 Acknowledgments

A special thank you to Mohammad Ayyash for initiating me into the dark magic of Python and Bash, and writing the first "molist" commands from which this utility evolved.

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

triplecheck-2.1.0.tar.gz (34.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

triplecheck-2.1.0-py3-none-any.whl (12.3 kB view details)

Uploaded Python 3

File details

Details for the file triplecheck-2.1.0.tar.gz.

File metadata

  • Download URL: triplecheck-2.1.0.tar.gz
  • Upload date:
  • Size: 34.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.20 {"installer":{"name":"uv","version":"0.11.20","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for triplecheck-2.1.0.tar.gz
Algorithm Hash digest
SHA256 220aa7fc49a5a64b9f90efcba2fa22bff7216d890f2407bd0040491a0bb0aff1
MD5 3677b1f2ebf11c21f72db4b1f5d4b088
BLAKE2b-256 d0da58db10bbb2aa1c228e38605ec23a6fe0c0aa37ce511b8fab7c778462eb32

See more details on using hashes here.

File details

Details for the file triplecheck-2.1.0-py3-none-any.whl.

File metadata

  • Download URL: triplecheck-2.1.0-py3-none-any.whl
  • Upload date:
  • Size: 12.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.20 {"installer":{"name":"uv","version":"0.11.20","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for triplecheck-2.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5e2bb998cef364689675df8ca80bccf0f218d51f8060b918a7e5fe31e74b5c3f
MD5 d870b552ae1b3e1cafff86113c4984be
BLAKE2b-256 eeb89cc4a25d188c66c434733934af0f362c8e795ccdf7e74061562b2e13acca

See more details on using hashes here.

Supported by

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