A Go port of dircmp, rearchitected around clean data structures.
dex [options] <dir> # find duplicates in a directory
dex [options] <src> <dst> # compare two directories
-a include hidden files
-r recurse subdirectories
-f fast digest (samples large files instead of full hash)
-b brief output (summary only)
-l show full digests
-d debug output
- Exact match — same relative path, same content
- Modified — same relative path, different content
- Same content, different path — content exists in both trees at different locations
- Only in src — no path match, no content match in dst
- Only in dst — no path match, no content match in src
make # build for current platform
make dist # build all platforms into dist/
make release # build and copy to releases/
make clean # remove build artifactsPrebuilt binaries are in releases/.
The tests/ directory contains src and dst trees for exercising the comparison logic.
To test error handling:
chmod 000 tests/src/broken-perms
./dex -a -r tests/src tests/dst
chmod 644 tests/src/broken-permsPorted from dircmp.py, rewritten with explicit data structures (Tree, CompareResult) instead of global state.