treecmp v0.7.2

Compares two directory trees by structure and content — and ignores the things that change for no reason, like timestamps and inode order.

Install

# from source, no dependencies beyond a C compiler
make && sudo make install

# or drop the single binary somewhere on PATH
install -m 755 build/treecmp /usr/local/bin/

Usage

treecmp ./release-1.4 ./release-1.5

  ~ bin/loader            content differs (412 B)
  + share/locale/pt_BR/   only in ./release-1.5
  - doc/legacy.txt        only in ./release-1.4
  = 1284 entries identical

Exit code is 0 when the trees match and 1 when they do not, so it drops into a build pipeline without extra glue.

Options

FlagEffect
-qPrint only the summary line.
-x PATTERNExclude paths matching a glob. Repeatable.
--hash=sha256Compare file contents by digest instead of byte-by-byte.
--followFollow symlinks. Off by default, and cycles are detected.
-j NHash files on N threads. Defaults to the core count.

Why not diff -r

diff -r reports differences line by line, which is the wrong granularity when you only need to know whether a build output changed. On large trees it also spends most of its time formatting output nobody reads. treecmp stops at the first differing block of a file and moves on.

On a 40k-file tree the difference is roughly 90 seconds versus 3.

Status

Maintained, but deliberately finished. Bug fixes and portability patches are welcome; new features almost certainly are not. The tool does one thing.