Mutt – Delete messages by date

Often you’ll have the need to perform an action that applies to multiple messages within a mailbox, and possibly multiple mailboxes to perform it in as well. Mutt is a great tool altogether, and the perfect tool for this job. If you want to, say, delete all messages older than 8 days, from the command line this will do the trick:

#> mutt -f Maildir -e 'push D~d>8d\rq\n'

If you have to do it on multiple mailboxes, it’s just as easy to wrap the command up in a loop:

#> for i in `ls -1 */Maildir`; do mutt -f $i -e 'push D~d>8d\rq\n'; done

Of course be careful with that ‘*’, it can be dangerous ;) Lots of more information here:

Post a Comment

Your email is never published nor shared. Required fields are marked *