
If you’ve got your mail sitting on some server and in Maildir format, and you’ve used Outlook’s “Auto Archive” feature, you might wish that your inbox (and subdirectory contents) could be automatically swept clean of items older than, say, 3 weeks, and shoved into a Year/Quarter sub folder (like “Inbox/2008/Q1/”).
A couple years ago I wanted this too. So I wrote a cronjob and perl script to make this happen.
Installation is straightforward:
- Copy the shell script that cron calls, autoarchive, and the perl script, autoarchive.pl, onto the server holding your Maildir.
- Edit the autoarchive shellscript to make sure the path and –max-days is ok with you.
- Make both scripts executable with
chmod u+x - Make a backup of your mail. This is GPL code. No warranty is implied. Read the code and try it out with –dry-run first.
- Calling autoarchive.pl with the “–dry-run” option will let you make sure it’s doing what you want it to do. If it does, delete the dry-run.
- Wire it up to cron with something like:
PATH=$HOME/bin:/usr/bin:/bin 42 10 * * * autoarchive > /dev/null
Related posts:
- How to view only unread gmail conversations
Gmail doesn’t have an obvious way to only look at conversations that are unread. If you don’t “archive” conversations out of your inbox, it can get pretty crufty. It’s easy...... - Verifying file integrity with debsums
After upgrading my Ubuntu server, some security applications grumped about changed contents of some common binaries. Just to be safe, I wanted to verify them explicitly with debsums, but debsums...... - Randomly sort the lines in a file
There are times when you need to randomly order the lines in a file. Here’s a script to do just that: #!/usr/bin/perl -w use strict; use List::Util 'shuffle'; my @lines...... - Simple MySQL backup to gmail on Ubuntu/Debian
Backing up your MySQL database (if it’s a reasonable size, like < 100s of MB) can be done with a cronjob that runs mysqldump, gzip, and mpack. First set up......