folder_parity — compare & sync¶
Recursively compares two folder trees, writes the differences to a CSV report, and can optionally copy files across to bring them in sync.
Each file is classified as:
| Status | Meaning |
|---|---|
MISSING_IN_1 |
exists in folder2, absent from folder1 |
MISSING_IN_2 |
exists in folder1, absent from folder2 |
DIFFERENT |
present in both, but contents differ |
Identical files are not reported.
Options¶
| Option | Description |
|---|---|
-o, --output <file> |
CSV report path (default report.csv) |
--hash |
Compare by 64-bit FNV-1a content hash, not just size (accurate, slower) |
-s, --sync |
Copy missing files to reconcile the folders |
--sync-to <1\|2\|both> |
Which folder receives missing files (default both) |
--prefer <1\|2\|newer\|larger> |
How to resolve DIFFERENT files during sync (default: skip) |
-j, --jobs <N\|-1> |
Threads for scanning/hashing (-1 = all cores; default 1) |
--ignore-system |
Skip OS metadata files (.DS_Store, ._*, Thumbs.db, …) |
--exclude <glob> |
Skip files matching a glob (repeatable) |
--ignored-output <file> |
Where to list ignored files (default <report>.ignored.csv) |
-v, --verbose |
Print each file as it is processed |
Exit codes: 0 identical · 1 argument/IO error · 2 differences found.
CSV report¶
relative_path,status,size_folder1,size_folder2,modified_folder1,modified_folder2[,hash_folder1,hash_folder2]
size_*/modified_*are blank on the side where the file is absent.- The two
hash_*columns appear only with--hash. - UTF-8 with a BOM (non-ASCII names render in Excel); RFC-4180 quoting.
--prefer values¶
When a file exists on both sides but differs, sync leaves it alone unless you say
which wins: 1 folder1, 2 folder2, newer most recently modified, larger
bigger file.
Examples¶
folder_parity ./backup ./live # size compare -> report.csv
folder_parity ./backup ./live --hash -o diff.csv # exact content compare
folder_parity ./backup ./live --sync --sync-to 1 # one-way mirror into backup
folder_parity ./a ./b --sync --prefer newer # two-way, newest wins
folder_parity "J:\Photos" "I:\Photos" --hash --jobs -1 --ignore-system
Notes¶
- Default size-only compare is fast but misses same-size edits — use
--hashwhen correctness matters. Threading helps--hashmost (it reads every byte). - Unicode names are fully supported. The tool never deletes; sync only adds or overwrites. Review the CSV before syncing important data.