[Dovecot] Purging old mails
Hi all,
Firstly if this is a FAQ and I've missed it - let me apologise in advance.
I use dovecot as a backup mail store and would now like to purge all mails over a certain age.
Is it as simple as using find and rm'ing the results or is there more to it?
I'm using maildir if that make a difference?
Thanks in advance.
Daveh
On Mon, 2006-08-07 at 20:42 +0100, Dave Hatton wrote:
Hi all,
Firstly if this is a FAQ and I've missed it - let me apologise in advance.
I use dovecot as a backup mail store and would now like to purge all mails over a certain age.
Is it as simple as using find and rm'ing the results or is there more to it?
I'm using maildir if that make a difference?
Just your folder? I have a cron job for a user with a Treo that does a broken pop and delete:
00 02 * * * /usr/bin/find
/usr/local/vpopmail/domains/domain/username/Maildir/new -mtime +4
-exec rm -f {} \;
+4 is 4 days 'ago'.
Rick
Thanks in advance.
Daveh
Rick Romero wrote:
On Mon, 2006-08-07 at 20:42 +0100, Dave Hatton wrote:
I use dovecot as a backup mail store and would now like to purge all mails over a certain age.
Just your folder? I have a cron job for a user with a Treo that does a broken pop and delete:
00 02 * * * /usr/bin/find
/usr/local/vpopmail/domains/domain/username/Maildir/new -mtime +4
-exec rm -f {} \;
I'm doing something similar, but I'm searching "Maildir/cur" not "Maildir/cur".
From my understanding, the mail "server" (MTA, LDA, ...) is supposed to deliver new mail to "Maildir/new", and once a mail client has seen the mail, it'll get moved to "Maildir/cur".
As such, deleting files from "Maildir/new" will only delete new, unread messages, which sounds dangerous!
Of course, perhaps not all software that manipulates Maildir follows the move-from-new-to-cur rule...
On Mon, 2006-08-07 at 14:34 -0600, Stephen Warren wrote:
Rick Romero wrote:
On Mon, 2006-08-07 at 20:42 +0100, Dave Hatton wrote:
I use dovecot as a backup mail store and would now like to purge all mails over a certain age.
Just your folder? I have a cron job for a user with a Treo that does a broken pop and delete:
00 02 * * * /usr/bin/find
/usr/local/vpopmail/domains/domain/username/Maildir/new -mtime +4
-exec rm -f {} \;I'm doing something similar, but I'm searching "Maildir/cur" not "Maildir/cur".
From my understanding, the mail "server" (MTA, LDA, ...) is supposed to deliver new mail to "Maildir/new", and once a mail client has seen the mail, it'll get moved to "Maildir/cur".
As such, deleting files from "Maildir/new" will only delete new, unread messages, which sounds dangerous!
Of course, perhaps not all software that manipulates Maildir follows the move-from-new-to-cur rule...
My fault - I have multiple cronjobs for deleting mail. The one I posted was for the 'admin' account, as sometimes the help desk person sets the 'default deliver to' to admin, instead of bounce :/ And we don't actually use 'admin' for email purposes.
You're right, for the first description, I delete from Maildir/cur
Rick
participants (3)
-
Dave Hatton
-
Rick Romero
-
Stephen Warren