Skip to main content

Compare Directories as macOS Disk Structures

Project description

      ___
     /\__\            _____              ___
    /:/  /           /::\  \           /\__\
   /:/  /           /:/\:\  \         /:/  /
  /:/  /  ___      /:/  \:\__\       /:/__/
 /:/__/  /\__\    /:/__/ \:|__|     /::\  \
 \:\  \ /:/  /    \:\  \ /:/  /    /:/\:\  \
  \:\  /:/  /      \:\  /:/  /     \/__\:\  \
   \:\/:/  /        \:\/:/  /           \:\  \
    \::/  /          \::/  /             \:\__\
     \/__/   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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cmpdisktree-0.2.1.tar.gz (17.2 kB view details)

Uploaded Source

Built Distribution

cmpdisktree-0.2.1-py2.py3-none-any.whl (16.4 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file cmpdisktree-0.2.1.tar.gz.

File metadata

  • Download URL: cmpdisktree-0.2.1.tar.gz
  • Upload date:
  • Size: 17.2 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for cmpdisktree-0.2.1.tar.gz
Algorithm Hash digest
SHA256 52997f10fa02caeba2b3f21a15ec18958262f801b6f0232690499d11247d113f
MD5 d0baa8ef31145b97a975b74e4bf62f9d
BLAKE2b-256 354921470cde8a3dc1f71e9d76bbc4bd60865149054a09c58a6151499cfa1e34

See more details on using hashes here.

File details

Details for the file cmpdisktree-0.2.1-py2.py3-none-any.whl.

File metadata

  • Download URL: cmpdisktree-0.2.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 16.4 kB
  • Tags: Python 2, Python 3
  • Uploaded using 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

File hashes

Hashes for cmpdisktree-0.2.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 e2da7525a9240ccb45abb14c15b6cee455d05260516b4aec4944f7f8aa3c285b
MD5 4bcbac21db267374386e372cac5ff781
BLAKE2b-256 08cdd0c7f8cdce27415290df354bf1270d21bbc1d52caa752e6a3dfa210b2869

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page