Re: Expunging and deleting old messages - moving from cyrus-imap
What is the equivalent in doveadm?
doveadm expunge -A DELETED BEFORE 1w
Is there any equivalent to expire messages marked as deleted? I can't remember why I have it as I set up Cyrus so long ago.
If by expire, you mean expunge, this is more or less what I used in a nightly cron script
doveadm expunge -A \( mailbox 'Deleted Items' OR mailbox 'Deleted Messages*' OR mailbox Junk OR mailbox Trash OR \( mailbox INBOX Deleted \) \) BEFORE 7d
In English, for all users, delete any messages in commonly named trash folders or any messages in INBOX marked as deleted that are older than a week.
I recall one quirk: if the mailbox didn't have a cached entry for the message's age, the filter criteria would miss this and it would remain in the mailbox. I'm not sure if this still happens, but I got around this by seeding the cache by doing a doveadm search for that metadata (date.received?).
Joseph Tam <jtam.home@gmail.com>
On 06/11/2024 22:19, Joseph Tam via dovecot wrote:
What is the equivalent in doveadm?
doveadm expunge -A DELETED BEFORE 1w
Is there any equivalent to expire messages marked as deleted? I can't remember why I have it as I set up Cyrus so long ago. If by expire, you mean expunge, this is more or less what I used in a nightly cron script
doveadm expunge -A \( mailbox 'Deleted Items' OR mailbox 'Deleted Messages*' OR mailbox Junk OR mailbox Trash OR \( mailbox INBOX Deleted \) \) BEFORE 7d
In English, for all users, delete any messages in commonly named trash folders or any messages in INBOX marked as deleted that are older than a week.
I recall one quirk: if the mailbox didn't have a cached entry for the message's age, the filter criteria would miss this and it would remain in the mailbox. I'm not sure if this still happens, but I got around this by seeding the cache by doing a doveadm search for that metadata (date.received?).
Joseph Tam<jtam.home@gmail.com>
In cron, I tried:
doveadm expunge -A DELETED BEFORE 5d
and got back:
Fatal: expunge: To avoid accidents, search query must contain
MAILBOX in all search branches
run-parts: /etc/cron.daily/dovecot-cleanup exited with return code 64
So I then tried:
doveadm expunge -A MAILBOX * DELETED BEFORE 5d
and got back:
Fatal: Unknown argument BOOT
run-parts: /etc/cron.hourly/dovecot-cleanup exited with return code 75
How can I run it for all mailbox folders without specifying them individually?
So I then tried:
doveadm expunge -A MAILBOX * DELETED BEFORE 5d
and got back:
Fatal: Unknown argument BOOT run-parts: /etc/cron.hourly/dovecot-cleanup exited with return code 75
How can I run it for all mailbox folders without specifying them individually? You need to quote the mailbox. This should work, i tested it with doveadm search
doveadm expunge -A mailbox '*' deleted before 5d
-- Christian Kivalo
On 07/11/2024 16:16, Christian Kivalo via dovecot wrote:
So I then tried:
doveadm expunge -A MAILBOX * DELETED BEFORE 5d
and got back:
Fatal: Unknown argument BOOT run-parts: /etc/cron.hourly/dovecot-cleanup exited with return code 75
How can I run it for all mailbox folders without specifying them individually? You need to quote the mailbox. This should work, i tested it with doveadm search
doveadm expunge -A mailbox '*' deleted before 5d
Thanks. I was literally typing the answer when you replied as cron.hourly (for testing) had just run OK.
participants (3)
-
Christian Kivalo
-
Joseph Tam
-
Nick Howitt