- Ignore errors/warnings (ex: "Permission denied"):
tm-diff.sh folder1 folder2 2> /dev/null
- Find all files, regardless of their privileges/permissions:
sudo tm-diff.sh folder1 folder2
- Display disk usage, in "human-readable" sizes (ex: KB, MB, GB...):
tm-diff.sh folder1 folder2 | while read f; do du -h "$f"; done
- Display disk usage, with a grand total at the end (sizes in KB):
tm-diff.sh folder1 folder2 | while read f; do du -k "$f"; done | awk '{ sum += $1; print; } END { print sum; }'
- Display the largest 50 files (sizes in MB):
tm-diff.sh folder1 folder2 | while read f; do du -m "$f"; done | sort -n | head -50
- Display the smallest 100 files (sizes in KB):
tm-diff.sh folder1 folder2 | while read f; do du -k "$f"; done | sort -rn | head -100
- Display a full listing (with mode/privileges, owner, group...):
tm-diff.sh folder1 folder2 | while read f; do ls -l -h "$f"; done
Notes:
- This presumes you've set your PATH so it'll find the tm-diff.sh script. (Or use its full path.)
- In the commands above, "folder1" and "folder2" of course represent the paths to the two Time Machine backup folders to compare; they'll look something like:
/VOLUMENAME/Backups.backupdb/USERNAME/2009-07-20-091153
- The script explicitly searches for regular files only; no directories or other special files.
- I use a read loop, since this will get the full path, including "special" characters like spaces and double-quotes.
- Sizes are in the classic style ("as God intended"): KB = 1024 bytes; MB = 1024 KB; GB = 1024 MB ...
- Most Time Machine backups contain tens of thousands of files, so these will take awhile. The ones that sort will display no files, until all of them have been found, to be sorted - so they will seem to take even longer.