larzbackup
Did every backup file arrive intact, and prune old ones.
Extracted from a real production backup pipeline: a sha256 + size + path MANIFEST.txt over a directory tree (hashing shells out to the real sha256sum/du, not a pure-Larzscript hash - crypto.sha256 is explicitly documented as fine for short inputs, not for hashing megabytes) plus real mtime-based retention pruning for dated snapshot directories.
larzscript pkg install backup
What you get
- sha256 + size + path MANIFEST.txt, same format as the real pipeline
- verify() classifies ok / missing / mismatched
- Shells out to sha256sum/du - fast on real backup-sized files
- prune_history() by real mtime, matching find -mtime
Try it
import "backup" as backup
write_file("/tmp/demo_backup/a.txt", "hello")
write_file("/tmp/demo_backup/b.txt", "world")
let entries = backup.build_manifest("/tmp/demo_backup")
for e in entries { print(e["path"], e["sha256"][0:8], e["size"]) }
backup.write_manifest(entries, "/tmp/demo_backup/MANIFEST.txt")
let loaded = backup.read_manifest("/tmp/demo_backup/MANIFEST.txt")
let result = backup.verify(loaded, "/tmp/demo_backup")
print("intact:", result["ok"])Output
a.txt 2cf24dba 4.0K b.txt 486ea462 4.0K intact: [a.txt, b.txt]
Why it's in the Larz Stack
larzbackup is a real Larzscript package (larzscript pkg install backup) - money-native, zero dependencies, the same language as the rest of the estate, not a separate Python runtime. It composes with the rest of the Larz Stack and the Larz framework.