Clean the inbox

Edit on GitHub

Attachments pile up in inbox/. hand inbox size shows how many files Hand saved there, their total size, the age of the oldest and of the newest, and what the trash holds. hand inbox prune --older-than 30d moves every attachment last modified more than 30 days ago into inbox/.trash/, and deletes each file that has been in the trash for more than 7 days. With --dry-run it lists both and changes nothing. It prints how many files it moved and deleted, and the space it freed.

To prune every day, add this to routing.json:

"inbox": {"keep": "30d"}

The watcher then runs the same prune once a UTC day. It writes the day to inbox/.trash/.pruned, so a restart does not run it again, and a file that failed waits for the next day's run. keep takes days, from 1d to 9999d. With "inbox": "off", or no inbox key, nothing is pruned. A bad value makes routing.json invalid, as a bad stall does: the error names the field, and the watcher logs it once and does not prune. hand orient shows inbox_folder: "612 files, 140 MiB" once the inbox holds more than 500 files or more than 100 MiB.