Profile Cleanup

Post Reply
Iocun
Posts: 174
Joined: Wed Dec 02, 2009 1:45 am

Profile Cleanup

Post 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.
Attachments
deleteOldProfiles.zip
(1.79 KiB) Downloaded 455 times

User avatar
Vadi
Posts: 4941
Joined: Sat Mar 14, 2009 3:13 pm

Re: Profile Cleanup

Post by Vadi »

It's best to update to http://forums.mudlet.org/viewtopic.php? ... 7415#p7415 before using this.

User avatar
Vadi
Posts: 4941
Joined: Sat Mar 14, 2009 3:13 pm

Re: Profile Cleanup

Post by Vadi »

This script is included by default now since Mudlet 2.0 by and by, so you can use the examples as-is.

User avatar
Belgarath
Posts: 232
Joined: Fri Jul 26, 2013 7:19 am
Discord: macjabeth#7149

Re: Profile Cleanup

Post 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)")

User avatar
Vadi
Posts: 4941
Joined: Sat Mar 14, 2009 3:13 pm

Re: Profile Cleanup

Post by Vadi »

@Iocun could you also make it handle module backups as well?

Post Reply