Profile Cleanup

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

Profile Cleanup

Post by Iocun » Mon Jul 18, 2011 1:23 pm

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 343 times

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

Re: Profile Cleanup

Post by Vadi » Mon Jul 18, 2011 8:38 pm

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

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

Re: Profile Cleanup

Post by Vadi » Sat Mar 04, 2017 12:57 pm

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#2283

Re: Profile Cleanup

Post by Belgarath » Sat Mar 04, 2017 10:14 pm

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: 4703
Joined: Sat Mar 14, 2009 3:13 pm

Re: Profile Cleanup

Post by Vadi » Sun Mar 12, 2017 7:05 am

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

Post Reply

Who is online

Users browsing this forum: No registered users and 8 guests