delete/archive old mail

Joseph Tam jtam.home at
Wed Oct 15 00:09:13 UTC 2014

"F." <sottilette at> writes:

>>> doveadm-altmove seems interesting, but in the man page it is reported
>>> only work with dbox (dbox-only), and my inboxes are in mbox format.
>>> Any other advice?
> As I originally wrote, my need is script or a command like the old
> that parse a local mbox folder and move/copy mail older
> than NN days to another local mbox folder.
> Probably for a Perl programmer is only matter of modify this script or
> something similar.
> I searched in docs, wiki, ... but not noticied something that can simply
> be inserted in a cron job to do the work.
> Only migration tools or complex (for me), library that can be used to
> manipulate folders :-)

I don't understand how you could have found doveadm-altmove, but miss
doveadm-move -- doesn't this dovecot command do exactly what you want?

 	$ man doveadm-move

 	     doveadm-move - Move messages matching the given search query
 	     into another mailbox

 	     Move janes messages - received in September 2011 - from  her
 	     INBOX into her archive.

 	     doveadm move -u jane Archive/2011/09 mailbox
 	     2011-10-01 SINCE 01-Sep-2011

 	[Is this a typo: "2011-10-01" should be "INBOX"?]

The example is fairly close to what you want.  Apart from the obvious change
to user and mailbox name, the condition would be "savedbefore ${NN}d".  You
might have to follow this up with an expunge if this operation does not
do that.

Joseph Tam <jtam.home at>

More information about the dovecot mailing list