Page 1 of 1

Profile Cleanup

Posted: Mon Jul 18, 2011 1:23 pm
by Iocun
Vadi asked me to write a Lua function that automatically deletes old profiles/maps, to reduce the pile of snapshots that build up over time. I'm posting the package consisting of a function and an alias here instead of the "Scripts & Packages" forum, because it's still meant for testing. Particularly, to learn whether it works fine on all operating systems, profile names, etc. and whether its functionality is what you people truly want.

This function requires the LFS (Lua file system) library, which should be contained in newer Mudlet versions (but I'm not sure off-hand since when).

Simply call the alias with: "delete old profiles/maps" to delete either old profiles or old maps. An optional further argument will specify a number of days: Files newer than so many days back will NOT be deleted. By default this is set to 31. Furthermore, the function will always keep a single profile/map of any month prior to the current one.

Examples:
"delete old profiles" -> deletes profiles older than 31 days, excepting one profile each for months before that.
"delete old maps 10" -> deletes maps older than 10 days, excepting one profile each for months before that.

I'm looking forward to any feedback.

Re: Profile Cleanup

Posted: Mon Jul 18, 2011 8:38 pm
by Vadi
It's best to update to http://forums.mudlet.org/viewtopic.php? ... 7415#p7415 before using this.

Re: Profile Cleanup

Posted: Sat Mar 04, 2017 12:57 pm
by Vadi
This script is included by default now since Mudlet 2.0 by and by, so you can use the examples as-is.

Re: Profile Cleanup

Posted: Sat Mar 04, 2017 10:14 pm
by Belgarath
Also, if you would like to automate the profile cleanup, you can add these two lines to the bottom of the script:
Code: [show] | [select all] lua
registerAnonymousEventHandler("sysExitEvent", "deleteOldProfiles(0, false)")
registerAnonymousEventHandler("sysExitEvent", "deleteOldProfiles(0, true)")

Re: Profile Cleanup

Posted: Sun Mar 12, 2017 7:05 am
by Vadi
@Iocun could you also make it handle module backups as well?