Mr. Self Destruct

Posted on 12th June 2008

Picked up a useful procmail tip the other day, and thought I'd help to promote it here. See Filtering mail with procmail for more details. As I hadn't done a cleanup of my backup mail files for some time, I was using up 1.5GB of disk space for messages that had already been processed. Most of the mails were spam, which have since been deleted. However, figuring out which files to delete is awkward as they all get named using the format of 'msg.XXXX', where XXXX is a random set of alphanumeric characters. This little tip, collates all the days mail into a single file, thus making it much easier to delete archives. I can now set up a cron job to delete month old archives once a month and keep my disk space at a more manageable level.

#
# Used for keeping a backup of each days mail.
#
BACKUP=$MAILDIR/backup
TODAY=`date +%d-%m-%Y`

#
# Save a copy of each email received into a file of the form
# '~/Mail/backup/dd-mm-yyyy'.
#
:0 c:
$BACKUP/$TODAY

File Under: backups / email / linux
NO COMMENTS


Some Rights Reserved Unless otherwise expressly stated, all original material of whatever nature created by Barbie and included in the Memories Of A Roadie website and any related pages, including the website's archives, is licensed under a Creative Commons by Attribution Non-Commercial License. If you wish to use material for commercial puposes, please contact me for further assistance regarding commercial licensing.