A bash script that creates and verifies SHA-256 sidecar files for data integrity checking. Perfect for protecting important files on NVMe drives, external storage, or any filesystem.
- Safe operation - Never deletes or modifies original files
- Multiple modes - Verify-only, create+verify, create-only
- Flexible exclusions - Skip system directories or unwanted paths
- Recursive processing - Handle entire directory trees
- Clear reporting - Shows hash mismatches, missing files, and summary stats
./nvme-integrity-checker.sh [OPTIONS] <directory>-cCreate hashes + verify existing (default: verify only)-fForce overwrite existing hashes-rRecursive-eExclude dirs (comma-separated)-nNo verify (create only)-vVerbose-hHelp
Check existing sidecar files for integrity violations:
# Verify files in current directory
./nvme-integrity-checker.sh .
# Verify recursively with verbose output
./nvme-integrity-checker.sh -rv /path/to/data
# Verify excluding specific directories
./nvme-integrity-checker.sh -rv -e "temp,cache" /Volumes/MyDriveCreate new sidecars and verify existing ones:
# Create sidecars for new files, verify existing ones
./nvme-integrity-checker.sh -cr /path/to/data
# With exclusions and verbose output
./nvme-integrity-checker.sh -crv -e "temp,logs,cache" /path/to/dataCreate sidecars for files that don't have them, skip verification:
# Fast mode - only create missing sidecars
./nvme-integrity-checker.sh -cnr /path/to/data
# Useful for initial setup or adding sidecars to new files
./nvme-integrity-checker.sh -cnrv -e "temp,logs" /Volumes/ExternalDriveMode: Verify only | Dir: /data | Recursive: Yes
✓ Verified: /data/video.mp4
✓ Verified: /data/audio.wav
Summary: 2 files, 2 verified, 0 failed
✓ Completed successfully
Mode: Verify only | Dir: /data | Recursive: Yes
✓ Verified: /data/good_file.txt
HASH MISMATCH: corrupted_file.txt
Summary: 2 files, 1 verified, 1 failed
ERROR: Completed with errors
Mode: Create + Verify | Dir: /data | Recursive: Yes
Hash exists for: /data/old_file.txt
Verifying: /data/old_file.txt
✓ Verified: /data/old_file.txt
Hashing: /data/new_file.txt
Created: /data/new_file.txt.sha256
Verifying: /data/new_file.txt
✓ Verified: /data/new_file.txt
Summary: 2 files, 2 created, 0 failed
✓ Completed successfully
- Sidecar files: Creates
.sha256files alongside your data files - SHA-256 hashing: Uses cryptographically secure hashing
- Non-destructive: Only creates new files, never modifies originals
- Smart skipping: Automatically skips
.sha256files and dot files/directories
- NVMe drive integrity monitoring - Detect silent data corruption when the drives have been disconnected for prolonged periods of time
- Archive/Backup verification - Ensure backups haven't been corrupted
- Transfer verification - Confirm files copied correctly
- Bash shell
shasumcommand (standard on macOS/Linux)findcommand with-print0support