Delete old captures
prune_capturesPrunes old captures, deleting all but the newest keep files to prevent the save directory from growing without bound.
Instructions
Delete all but the newest keep captures, and say which went.
Captures accumulated forever. shot writes one per call and nothing ever
removed them, so an agent photographing in a loop grew the SAVE DIRECTORY
without bound — the folder holding the worlds and characters, which is not
a cache and not somewhere to leave litter.
Args:
keep: How many of the newest captures to keep. REQUIRED and
deliberately without a default, the same way shot requires a
region: this deletes files, and a destructive tool that runs with
no arguments is one that gets called by accident. keep=0 removes
all of them, which is a real request and has to be spelled out.
Only files matching THIS mod's capture pattern are touched, and each is
re-checked to resolve to a direct child of the save directory — the same
containment read_capture uses, because a delete that listed and removed
through different rules would be looser than the read beside it. The whole
set is validated before anything is unlinked, so a refusal costs nothing
rather than leaving a half-finished prune.
Newest is decided by MTIME, not by the index in the filename: the index is this harness's counter and the timestamp is the disk's account of what happened.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| keep | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| removed | Yes | ||
| remaining | Yes |