How to I bulk delete Automated backups

Re: How to I bulk delete Automated backups

by Laurent Wafflard -
Number of replies: 7
Picture of Particularly helpful Moodlers

Due to an issue of the external backup space (backup_auto_destination), we also had an explosion of space consumed on moodledata.
The script attached (in french, sorry)  :
    list the automatic backups stored on moodledata
    can copy them elsewhere ("demo" = dry-run, nothing is actually done but it show what would be)
    can delete them (with "demo")

It should be stored at the root of Moodle files (the same level as config.php). Only a Moodle Administrator can call it  (http://moodle_url/purge_autobackup.php)

DATE_BACKUP at beggining of script limit action to a specific date or year.

Hope this help.

Average of ratings: Useful (3)
In reply to Laurent Wafflard

Re: How to I bulk delete Automated backups

by Travis Johnston -

Thanks! I used your script today and was able to get rid of 95GB's of bad backups!

In reply to Laurent Wafflard

Re: How to I bulk delete Automated backups

by Petrus 4 -

Thanks Laurent Wafflard  that was php script worked tres bien!

I recommend it be added to moodle as one of the admin scripts! smile


 

In reply to Petrus 4

Re: How to I bulk delete Automated backups

by Séverin Terrier -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators

You should perhaps create a tracker issue for that (if none already exists), or talk about that in related issues in the tracker...

Séverin

In reply to Laurent Wafflard

Re: How to I bulk delete Automated backups

by Jean Pierre Ducassou -

Awesome job Laurent!

I wanted to run it on console and be able to pass different parameters so I writed a script based on yours.

I hope you don't mind.

It will be on github in case anyone wants to fix or enhance something.

https://github.com/jpducassou/moodle-tool_autobackups

Thanks again to you and all the community.


Average of ratings: Useful (1)
In reply to Jean Pierre Ducassou

Re: How to I bulk delete Automated backups

by Laurent Wafflard -
Picture of Particularly helpful Moodlers

Of course no problem for the new version wink Very good idea to make a cli script and even better one to share it !

Thanks for these improvements, we'll try it soon !

In reply to Laurent Wafflard

Re: How to I bulk delete Automated backups

by Jean Pierre Ducassou -

You're welcome. If you need any feature or have any suggestion feel free to contact me.

Average of ratings: Useful (1)
In reply to Jean Pierre Ducassou

Re: How to I bulk delete Automated backups

by Julia Küfner -

Thank you Laurent and Jean Pierre!

Your tool saved me! Successfully deleted 51 GB!

(In my case I had to move to a different server and forgot so set the rights of the backup folder (a non-moodledatafolder on the same server), moodle couldn't access it and started adding backupfiles in filedir without deleting them...) 

here a short info to the script that I "learned" while using it:

-q (query; show the automated backupfiles )
-c (copy; copy files to location)
-d (directory)
-x (expunge; delete automated backupdfiles)

all files are deleted, which means they are send to trashdir (the timestamp of the last emptying of trashdir is set to the past), the next time cron is running tashdir is emptied.