Mailcow: Archive/Delete Old E-mails

Modified on Mon, 16 Mar at 6:13 PM

sudo -i
cd /opt/mailcow-dockerized
docker compose exec dovecot-mailcow bash
cd /var/vmail/acmecorp.com/mailboxname/Maildir

# get count of items in inbox older than 30 days
find cur/ -type f | wc -l

# get count of items in inbox older than 30 days
find cur/ -type f -mtime +30 | wc -l

# move items in inbox older than 30 days to old folder (not visible in imap)
find cur/ -type f -mtime +30 -exec mv {} old/cur/ \;

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article