[Dovecot] Please HELP: how to delete all messages older than X days from the server?

Răzvan Sandu razvan.sandu at mobexpert.ro
Wed Aug 7 11:22:21 EEST 2013


On Tue, 06 Aug 2013 19:18:15 +0200, Pascal Volk a scris:

> There is also the -A option, see
> http://wiki2.dovecot.org/Tools/Doveadm/Expunge#section_options


Thank you, but doveadm expunge will ask for the mailbox name:

[root at mail1 ~]# doveadm expunge -u john.doe at example.com ON 2013-08-07
doveadm(root): Fatal: expunge: To avoid accidents, search query must
contain MAILBOX in all search branches

What I need is to traverse *all* directories under
/var/spool/mail/vhosts/domainname/  (which are
/var/spool/mail/vhosts/domainname/username, with further variable
subdirectories, name never known in advance...) and to delete all
messages older than X days (incoming, sent, drafts, trash, etc.)

This must be done without manual confirmation ("are you sure...?") (if I
do it via a script run from cron).

>From the examples given in the wiki page, the expire plugin presents the
same problem: one must know in advance the *name of the mailbox* he has
to empty.

Also for the correct search criteria: should I use SAVEDBEFORE or
SENTBEFORE ?


Thanks again,
Răzvan








-------------- next part --------------
A non-text attachment was scrubbed...
Name: razvan_sandu.vcf
Type: text/x-vcard
Size: 452 bytes
Desc: not available
URL: <http://dovecot.org/pipermail/dovecot/attachments/20130807/6b92ba66/attachment.vcf>


More information about the dovecot mailing list