retentions is a small but feature-rich command-line tool for applying backup-style retention rules to arbitrary file or folder sets.

We built retentions to reliably solve a problem that appears in many operational environments: pruning files in a predictable and auditable way, independent of backup software, storage systems, or external services. retentions operates directly on the filesystem, works with plain directories, and does not require any special layout or metadata.

The tool supports a wide range of retention strategies, including time-based retention across multiple granularities, keeping the last N items, and enforcing upper bounds by total size, file count, or age. Retention rules are applied deterministically, with clear precedence, and can be combined to model real-world retention policies without hidden side effects.

retentions places strong emphasis on safety and transparency. Dry-run and list-only modes allow operators to inspect planned actions before any deletion occurs, and detailed decision logging explains why each file is kept or removed. Optional lock files prevent concurrent runs, and integrity checks ensure that retention decisions remain consistent and verifiable.

Advanced features such as companion file handling, protection rules, and the ability to skip potentially corrupt files make retentions suitable for a broad range of use cases, from simple cleanup jobs to complex, long-running retention workflows.

retentions is cross-platform, dependency-free, and distributed as a single executable script. It is intended for users who value clarity, correctness, and explicit control over automated file retention.

You can get it here ↗ or using the ThK-Systems Debian Repository