Skip to main content
      ___
     /\__\            _____              ___
    /:/  /           /::\  \           /\__\
   /:/  /           /:/\:\  \         /:/  /
  /:/  /  ___      /:/  \:\__\       /:/__/
 /:/__/  /\__\    /:/__/ \:|__|     /::\  \
 \:\  \ /:/  /    \:\  \ /:/  /    /:/\:\  \
  \:\  /:/  /      \:\  /:/  /     \/__\:\  \
   \:\/:/  /        \:\/:/  /           \:\  \
    \::/  /          \::/  /             \:\__\
     \/__/   mp       \/__/   isk         \/__/ ree

Compare Directories as macOS Disk Structures

The Problem

You make backups from your macOS disk, right? But how can you check that your important stuff got copied correctly? Using

diff -r FS1 FS2

gives you so many errors that the command is impossible to use. This is caused by a few separate problems, but the main one is: Symlinks with non-existing target are reported as errors by diff, but for a disk compare we only want to know whether the target paths in the links are the same, not whether the targets exist.

cmpdisktree to the rescue! This command line tool compares filesystems ("disks") in a sensible way for backup check. It checks symlinks for same target path and excludes by default some system directories. It is mainly designed for macOS disks but via some options it can be tweaked for other purposes.

Here the help message:

Usage: cmpdisktree.py [OPTIONS] FS1 FS2

  Compare the directories FS1 and FS2 as macOS disk structures

  Errors are reported to a file (default 'cmp-err.log')

Options:
  -v, --verbose                  Print debug output
  -q, --quiet                    No informational output
  -i, --report-identical         Report identical files to file (default:
                                 'cmp-ok.log')

  -1, --traversal-only           Only traverse FSs (Phase 1). Don't compare
                                 file contents

  -t, --traverse-from-list PATH  Path of file with list of relative paths for
                                 traversal

  -c, --clear-std-exclusions     Don't apply the standard exclusions for macOS
                                 disk files systems (i.e. compare everything)

  -l, --live-fs-exclusions       Add exclusions for live filesystems (e.g.
                                 boot volumes)

  -m, --ignore-missing-in-FS1    Ignore when a file from FS2 doesn't exist in
                                 FS1 (used for boot backups where FS1 is the
                                 live disk)

  -r, --relative-fs-top          Allow relative filesystem top (used when
                                 applying the exclusions)

  -o, --output-path PATH         Output path for report file.
  --version                      Show the version and exit.
  --help                         Show this message and exit.

Details to some options

--output-path PATH: : Set where the output should go:
If the path of a file is given, use this file as error log file and write (if applicable) the OK log to cmp-ok.log in the same directory.
if the path of a directory is given, write cmp-err.log and cmp-ok.log in this directory.

--relative-fs-top: : Normally exclusion patterns which match only at the beginning of a path name have to start with that pattern as expected. This option widens the match to the middle of a path name as well. This is useful if you want to check on boot filesystems which you have copied deeper into a file system.

--live-fs-exclusions: : Use additional exclusions which ignore files like .DS_Store. This helps to compare "life" filesystems as the same even if these files have changed (e.g. by looking at the file structure in Finder). This adds some various (experimental) cache exclusions as well.

--traverse-from-list PATH: : Do not traverse the filesystem; instead use the list of relative paths given in a text file (one path per line). The paths are relative to the starting directories FS1/FS2.
Note: Only paths to normal files are compare for same content. _Directories are only checked for existence in FS1 and FS2; symlinks are only checked that they point to the same target

Credits

Thanks to Kent Nassen and Lennert Stock for the ASCII art characters.

Metadata

Release files for cmpdisktree 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cmpdisktree 0.2.1
File Size Uploaded Provenance Actions
cmpdisktree-0.2.1.tar.gz 17.2 kB Without provenance Details for cmpdisktree-0.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for cmpdisktree 0.2.1
File Interpreter ABI Platform Actions
cmpdisktree-0.2.1-py2.py3-none-any.whl Python 2, Python 3 none any Details for cmpdisktree-0.2.1-py2.py3-none-any.whl

Total release size: 33.6 kB

Release files / cmpdisktree-0.2.1.tar.gz

Download URL cmpdisktree-0.2.1.tar.gz
Size 17.2 kB
Tags Source
SHA-256 checksum
How to use checksums
52997f10fa02caeba2b3f21a15ec18958262f801b6f0232690499d11247d113f
BLAKE2b-256 checksum
How to use checksums
354921470cde8a3dc1f71e9d76bbc4bd60865149054a09c58a6151499cfa1e34
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.6

Release files / cmpdisktree-0.2.1-py2.py3-none-any.whl

Download URL cmpdisktree-0.2.1-py2.py3-none-any.whl
Size 16.4 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
e2da7525a9240ccb45abb14c15b6cee455d05260516b4aec4944f7f8aa3c285b
BLAKE2b-256 checksum
How to use checksums
08cdd0c7f8cdce27415290df354bf1270d21bbc1d52caa752e6a3dfa210b2869
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.6

Security for cmpdisktree 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page