Find and delete files

Few months ago, I had a problem after mail server migration. The old mail server decided to die and I had to replace the complete server. I read my logs carefully (on daily basis) and I noticed that hard disk will die so I prepared the complete backup before the damn thing decided to go to the hell.
The old server had the same software like the new one but Dovecot 2.x comes with disabled quota function.
Unfortunately I forget to check this which causes that after 2-3 days I run into problems with more than 15 000 email accounts. Deleted mails was not deducted from used quota and almost all mailboxes was marked as 100% used :(. The solution was to delete all maildirsize files inside mailboxes and let the Postfix to recreate this file as soon as the next email arrives.

As any other problem on Linux, this one also can be solved in one command 🙂

find . -type f -name "maildirsize" -exec rm -fv {} \;

Leave a Reply

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