[Dovecot] How to delete old mails in dovecot 1.2.x
Steve Litt
slitt at troubleshooters.com
Fri Feb 17 01:52:31 EET 2012
On Fri, 17 Feb 2012 01:28:28 +0200
Timo Sirainen <tss at iki.fi> wrote:
> On 17.2.2012, at 0.39, Przemysław Orzechowski wrote:
>
> > I need to delete old mails from over 100 mailboxes with average of
> > 10k mails / mailbox
> > Is there a way to delete old mails (by message date not file
> > creation date) as with doveadm in dovecot 2 ?
>
> You can delete them by mtime or by ctime:
>
> http://wiki.dovecot.org/Plugins/Expire#v1.0_cronjob_equivalent
>
> If by "message date" you mean the Date: header, then there's no easy
> way.
>
Would something like the following work for the date header?
#!/bin/bash
for msg in *; do
if b4.py $msg 20080216; then
rm $msg
fi
done
#!/usr/bin/python
datestring = get_dateline() ## FIND DATE HDR AND RETURN THE STRING
yyyymmdd = format2yyyymmdd(datestring) ## CONVERT TO YYYYMMDD
if yyyymmdd < sys.argv[1]:
sys.exit(0)
else:
sys.exit(1)
In the preceding, would the deletions mess up maildir indices?
Thanks
SteveT
More information about the dovecot
mailing list