If your cron pushes DB dumps to Dropbox and they pile up, this Bash script prunes old backups while keeping the newest N files. Bash only, no Dropbox API. Read/clone: https://github.com/cre8llc/Dropbox-Cleaner
The algorithm: list files by mtime, keep the newest N, and delete files older than X days that aren’t in that keep set. Works in a client‑synced folder — zero API creds, no rate limits. Key tradeoff: it trusts local filesystem timestamps.
Real risks: sync lag and partial uploads can make you delete what’s still transferring. Quick fixes I’d add: use flock to serialize runs, upload to .part then mv, verify file size stable over 1–2 minutes, and add --dry-run + logging.
Takeaway: for solo ops and small agencies this is pragmatic — fewer moving parts beats premature API work. If you need server‑side atomicity or scale, switch to rclone or the Dropbox API. How do you handle retention for large backup fleets?
Top comments (0)