Skip to Content

Automation

Run purgeit unattended with cron, launchd, systemd or CI, and act on its exit codes.

Unattended runs should be conservative and leave a trail.

# everything in projects you have not worked on for 30+ days, over 100 MB
purgeit clean ~/dev --stale --min-size 100MB --yes

clean already skips recent activity (default 7 days), re-verifies every path, logs to purgeit history, and reports problems through its exit code, so a scheduler can notice.

Exit codes

CodeMeaning
0success
1some paths were skipped or failed, or you declined the confirmation
2bad arguments, config or plan
70internal error
130interrupted (SIGINT/SIGTERM)

Without a terminal and without --yes, clean refuses to delete rather than guessing.

Schedulers

0 3 * * 0  /usr/local/bin/purgeit clean ~/dev --min-age 30d --yes >> ~/purgeit.log 2>&1

Reviewed automation

When a person must approve what an unattended job deletes, split the job in two (see Clean safely): the first writes a plan with scan --format json; the second runs clean --plan after approval.

Machine-readable output

scan --format json|ndjson and clean --format json are documented in Output formats.

On this page