pg_archivecleanup
Remove old WAL archive files in PostgreSQL. tldr-pages
On several platforms
Several platforms
Clean an archive directory up to a given WAL file
pg_archivecleanup path/to/archive path/to/walfileIdentifySimulate removing files without actually doing it
pg_archivecleanup --dry-run path/to/archive path/to/walfileIdentifyStrip a file extension before deciding deletion
pg_archivecleanup --strip-extension extension path/to/archive path/to/walfileIdentifyRemove backup history files too
pg_archivecleanup --clean-backup-history path/to/archive path/to/walfileIdentifyEnable debug logging output
pg_archivecleanup --debug path/to/archive path/to/walfileIdentify