Delete old spam from spam-folder in virtual mailbox (Dovecot)
Here’s a little script I wrote to delete old emails in your spam-folder. It assumes that files are located in subfolders of /var/vmail/ called Maildir/.Spam/new and Maildir/.Spam/cur
#!/bin/bash
find /var/vmail -type d | sed ’s/ /\\ /g’ | grep “Maildir/.Spam/” |
while read line
do
find ${line}new/ -mtime +365 2>/dev/null -exec rm {} \;
find ${line}cur/ -mtime +365 2>/dev/null -exec rm [...]
