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
-iflag to ignore folder structure and focus exclusively on files (useful if directories have been nested, moved around or renamed in one of your copies).
This is a cross-platform tool (macOS / Linux / Windows) written in Python and integrating the xxhash package for high-throughput hashing and blake3 for cryptographic hashing.
- Install the
uvpackage manager with the official installer, or:
- macOS:
brew install uv - Windows:
winget install astral-sh.uv - Linux (Debian):
apt-get install uv
- Install the tool:
uv tool install triplecheck- Test the installation (if the command is not recognised try
uv tool update-shelland restart Terminal):
triplecheck --versionCompare two (or three) files or directories:
triplecheck "path/to/file1" "path/to/file2" # full comparison of files
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 directory 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 filesCheck that the destination contains all of the files from the source:
triplecheck "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.
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.