Kevin P. Fleming 54727e1851 %!s(int64=19) %!d(string=hai) anos
..
README.messages-expire 54727e1851 %!s(int64=19) %!d(string=hai) anos
addmailbox 54727e1851 %!s(int64=19) %!d(string=hai) anos
astgenkey 54727e1851 %!s(int64=19) %!d(string=hai) anos
astgenkey.8 54727e1851 %!s(int64=19) %!d(string=hai) anos
astxs 54727e1851 %!s(int64=19) %!d(string=hai) anos
autosupport 54727e1851 %!s(int64=19) %!d(string=hai) anos
autosupport.8 54727e1851 %!s(int64=19) %!d(string=hai) anos
iax-friends.sql 54727e1851 %!s(int64=19) %!d(string=hai) anos
messages-expire.pl 54727e1851 %!s(int64=19) %!d(string=hai) anos
postgres_cdr.sql 54727e1851 %!s(int64=19) %!d(string=hai) anos
qview.pl 54727e1851 %!s(int64=19) %!d(string=hai) anos
retrieve_extensions_from_mysql.pl 54727e1851 %!s(int64=19) %!d(string=hai) anos
retrieve_extensions_from_sql.pl 54727e1851 %!s(int64=19) %!d(string=hai) anos
retrieve_sip_conf_from_mysql.pl 54727e1851 %!s(int64=19) %!d(string=hai) anos
safe_asterisk 54727e1851 %!s(int64=19) %!d(string=hai) anos
safe_asterisk.8 54727e1851 %!s(int64=19) %!d(string=hai) anos
sip-friends.sql 54727e1851 %!s(int64=19) %!d(string=hai) anos
vmail.cgi 54727e1851 %!s(int64=19) %!d(string=hai) anos
vmdb.sql 54727e1851 %!s(int64=19) %!d(string=hai) anos

README.messages-expire

messages-expire.pl

messages-expire finds messages more than X days old and deletes them.
Because the older messages will be the lower numbers in the folder (msg0000
will be older than msg0005), just deleting msg0000 will not work.
expire-messages then runs a routine that goes into every folder in every
mailbox to reorganize. If the folder contains msg0000, no action is taken.
If the folder does not, the rename routine takes the oldest message and
names it msg0000, the next oldest message and names it msg0001 and so on.

The file deletion is done by the -exec parameter to 'find'. It would be far
more efficient to take the output from 'find' and just reorganize the
directories from which we deleted a file. Something for the future...

Keep in mind that messages are deleted at the beginning of the script you
will have mailbox trouble if you check messages before the script
reorganizes your mailbox.

To use it, make sure the paths are right. Adjust $age (originally set to
31) if necessary.