Cleaning Up Maildir Directories
I have a TON of old messages to clean up in a maildir style directory. I don’t want to just delete them, but I do need to clear some space. Unfortunately, setting up a mail account to download and delete them will take forever.
A few Google searches have revealed this fun tool: cleanup-maildir.
cleanup-maildir [OPTION].. COMMAND FOLDERNAME..
Cleans up old messages in FOLDERNAME; the exact action taken
depends on COMMAND. (See next section.)
Note that FOLDERNAME is a name such as ‘Drafts’, and the
corresponding maildir path is determined using the values of
maildir-root, folder-prefix, and folder-seperator.
archive – move old messages to subfolders based on message date
trash – move old message to trash folder
delete – permanently delete old messages
There it is in a nutshell. Not only will this let you totally cleanup a maildir mailbox, but since it’s just a single python script, it’ll let you automate any archiving or deletion tasks to your heart’s content — either as a single user or as an admin keeping an entire system under control.
It’s worth bouncing off of the project page for some examples and for a direct download link for the script. Just “save as” and copy the script to the host with your mailbox.
Keep in mind that you need python installed. I’m currently testing it with version 2.4.5 and I’ve not run into any trouble.
Definitely a good tool to keep around for just these situations!