features
downloads
screenshots
contribute
contact
references
faq
help

Community Discussion: Backup Rotation Settings in phpMyBackupPro

user42
Posted: 2025-06-25 10:14

Hi everyone,

I’m currently using phpMyBackupPro for scheduled backups and it’s working great. However, I’m trying to limit the number of stored backups (e.g. only keep the last 5). Is there a built-in setting for this or do I need to use a custom script?

dev_admin
Posted: 2025-06-25 11:03

There’s no direct setting inside the UI, but you can use a small shell script or PHP snippet to delete older backups after each new one is created.

For example:

ls -tp /backups | grep -v '/$' | tail -n +6 | xargs -I {} rm -- /backups/{}

This keeps the 5 newest files in the directory and removes the rest.

backup_geek
Posted: 2025-06-25 12:18

I added a PHP version to cron.php that scans the backup folder and deletes files older than 7 days. Works well with FTP too if mounted.

netops_jp
Posted: 2025-06-25 13:45

Thanks all. I wrapped this into a post-backup hook so it cleans up after every successful job. Maybe this could be added as an official feature someday.