Filesystem Backup -- option to delete old backups

Hi,
I created scheduled backups that are stored on a FTP server.
After a couple of months my storage gets full. I would like to know the best way to delete backups that are older than a specified amount of days.
Should I run a script s a Command to run after backup?
Can I access Password for SSH/FTP login, host and user variables from the module in my script or i have to hardcode them?
Is there any chance that someone ports this feature from Scheduled Backups inVirtualmin?

Thanks

One option is using Virtualmin “Delete old backups” feature.

  1. Using Virtualmin navigate to “Backup and Restore” > “Scheduled Backups”
  2. When creating a backup one of the option is titled: “Delete old backups > Yes, after X days”

From the manual:
Delete old backups
If you are backing up to a local directory or S3 bucket whose path is based on the backup time, this option can be used to delete backups older than some number of days. This can be useful to reduce the amount of disk space needed to store old data.

However, this is only usable when the backup destination directory is named like /backup/%d-%m-%Y, or the filename is named like /backup/virtualmin-%d-%m-%Y.tar.gz. This is required for Virtualmin to be able to work out which files and directories were created by the backup process.

You must also check the box Do strftime-style time substitutions on file or directory name, or else date and time codes in the backup path will not be converted when the backup is run.

The maximum backup age is entered in days, but you can use fractions like 0.25 for four hours.

Hi this is a great answer for Virtual Server Backups - but for Filesystem Backups in Webmin these options aren’t present.

I’m also looking for a way to auto-delete old “Filesystem Backups” so my storage doesn’t max out. Any help appreciated.

Thanks :slight_smile:

I set up a cron job in webmin as root to find and delete old files after certain age in my webmin config backups and flle system backups.

find /media/md1/cfgbu/ -mtime +120 -exec rm {} ;

That finds files in cfgbu folder older than 120 days then executes the rm command on them. Note the spaces are important. And maybe replace the rm with ls, so it will list files it found so you don’t delete things accidentally. Then once satisfied with the command, change it back to rm.

More info on its use here. https://www.howtogeek.com/howto/ubuntu/delete-files-older-than-x-days-on-linux/

Thanks that’s just what I needed. Much appreciated :slight_smile: