299

[Ruby] Backup Verifier Script

The following ruby script compares two directories recursively, and alerts the user of any differences. It compares files by size and (optionally) by a random sample of contents. The results are summarized into a difference percentage so it can be used to easily determine if a backup is valid and recent.

Usage

Usage: /usr/bin/vfy [options] <original> <backup>
    -v, --verbose                    Print what is being done
    -m, --machine                    Output summary in machine-readable format
    -f, --[no-]follow                Follow symlinks
    -x, --one-filesystem             Stay on one file system (in <original>)
    -c, --count                      Count files in unmatched directories
    -i, --ignore DIR                 Don't process DIR
    -s, --samples COUNT              Comparison sample count (default: 0)
    -h, --help                       Display this screen

Sample Summary Output

SUMMARY:
    Items processed: 457382
    Differences: 1183 (0.26%)
    Similarities: 456199
    Skipped: 635
    Errors: 1

Script

Source Code on GitHub