[Dovecot] Deleting messages from MailDir

Rody rody at xs4all.nl
Tue Feb 12 23:45:08 EET 2008


Funny, I asked a few days ago a similar question with the subject: 
[Dovecot] replacement for IMAP_EMPTYTRASH=Trash:7
You may want to look for the responses to that question as it's essentially 
the same.
In short: you can do this with a find command to remove older mails. There 
should be no issues as maildir files don't need to be locked in order to do 
it properly.
The opinions vary slightly when it comes to using mtime or ctime. I've chosen 
ctime because i believe using mtime will not garantee that there aren't any 
mails left which are actually older than 30 days. I believe there are cases 
where mtime may get changed, where ctime will not. Also, ctime starts 
counting from the moment the mail gets dropped in a certain mailbox.
Anyway for 30 day's i'd say you need ctime +29 or mtime +29 as the man pages 
explain that +0 means actually up until 1 day old.

Regards,
Rody

Op dinsdag 12 februari 2008 19:15, schreef Matt Richards:
> Hello,
>
> I have dovecot running with MailDir as a backend to store email and I would
> like to remove mail that is older that 30 days.
>
> I can do this by running 'find' on the MailDir but will this cause any
> issues with dovecot?
>
> Thanks,
>
> Matt.


More information about the dovecot mailing list