Restore trashed mails from dovecot maildir


To remove the “T”rashed flag from mails in a maildir, the files need to be renamed.

rename 's/(.+),ST$/$1,S/' ./**/*
rename 's/(.+),RST$/$1,RS/' ./**/*
rename 's/(.+),STab$/$1,Sab/' ./**/*
find . -type f -regex '.*,\(ST\|RST\|STa\|STb\|STab\)' -exec echo `echo {}` \;

I have also created a script which can be executed in the Maildir, searching for files and renaming the files: https://gist.github.com/mattanja/1367bc04750dd105317f

,

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.