[Dovecot] How to delete old mails in dovecot 1.2.x
Hi
I have already read this page but there is no info on how to delete old mails in dovecot 1.2 http://wiki1.dovecot.org/QuestionsAndAnswers#How_can_I_create_a_cron_or_some...
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 ?
Thanks in advance
bellow my dovecot -n (not sure if it is neccessary or not so just in case)
# 1.2.9: /etc/dovecot/dovecot.conf # OS: Linux 2.6.32-33-server x86_64 Ubuntu 10.04.3 LTS log_timestamp: %Y-%m-%d %H:%M:%S protocols: imap imaps pop3 pop3s ssl_cert_file: /etc/ssl/makolab/star_makolab_pl.crt ssl_key_file: /etc/ssl/makolab/star_makolab_pl.key disable_plaintext_auth: no login_dir: /var/run/dovecot/login login_executable(default): /usr/lib/dovecot/imap-login login_executable(imap): /usr/lib/dovecot/imap-login login_executable(pop3): /usr/lib/dovecot/pop3-login mail_privileged_group: mail mail_location: maildir:~/Maildir mbox_write_locks: fcntl dotlock mail_executable(default): /usr/lib/dovecot/imap mail_executable(imap): /usr/lib/dovecot/imap mail_executable(pop3): /usr/lib/dovecot/pop3 mail_plugins(default): quota imap_quota mail_plugins(imap): quota imap_quota mail_plugins(pop3): quota mail_plugin_dir(default): /usr/lib/dovecot/modules/imap mail_plugin_dir(imap): /usr/lib/dovecot/modules/imap mail_plugin_dir(pop3): /usr/lib/dovecot/modules/pop3 auth default: passdb: driver: pam userdb: driver: passwd plugin: quota: fs:Limit uzytkownika:user quota2: fs:Limit domeny:group
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.
On Fri, 17 Feb 2012 01:28:28 +0200, Timo Sirainen tss@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.
Yes Date header unfortunatly (seems i will have to write some kind of script for that)
Just to be sure just deleting mail files is safe? Or do i have to run some additional commands to recreate dovecots index files? I'm using Maildir.
Asking just to be sure that I will not screw up something.
On Fri, 17 Feb 2012 01:28:28 +0200 Timo Sirainen tss@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
participants (3)
-
Przemysław Orzechowski
-
Steve Litt
-
Timo Sirainen