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
|