lookback is a file and directory comparison tool. It answers two related questions:
- Are these two files the same? Hashes both files and compares the digests.
- Do these two directories contain the same files? Either compares file names and sizes (default), or hashes every file and compares the digests (full comparison mode). Optional
-iflag ignores folder structure to focus exclusively on files (useful when directories have been moved around or renamed).
This is a cross-platform tool (macOS / Linux / Windows) written in Python and integrating the xxhash package for high-throughput hashing.
-
Install the
uvpackage manager with the official installer (orbrew install uvon macOS / Linux). -
Install the tool:
uv tool install lookbackCompare two files:
lookback <file1> <file2>
Compare two directories:
lookback <source> <destination> # metadata only (filenames and file sizes)
lookback -f <source> <destination> # full comparison mode: hash every file
lookback -i <source> <destination> # ignore folder structure
Check that the destination contains all of the files from the source:
lookback <source> <destination> | grep "<"
Output uses a diff-like format. Lines starting with < are unique to the source side, > lines are unique to the destination side:
$ lookback /Volumes/PRJ_MST01 /Volumes/PRJ_BAK01
< 1432891 IMG_0421.dng
> 1432891 IMG_0422.dng
Other options (run lookback --help for full list):
-f, --full : deep mode: hash every file (slower but safer)
-i, --ignore : ignore folder structure (compare flat list of file names and sizes)
-a, --algorithm [xxh64|xxh128] : hash algorithm (default: xxh64)
-s, --save : save listing for manual comparison
-X, --appledouble : include AppleDouble (._*) files
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.