Remove empty milder folders

@lbutlr kremels at kreme.com
Wed Jan 18 19:41:08 UTC 2017


On 2017-01-16 (08:48 MST), Darac Marjal <mailinglist at darac.org.uk> wrote:
> 
> On Mon, Jan 16, 2017 at 07:03:49AM -0700, @lbutlr wrote:
>> Not sure if anyone will find this useful, but this is how I deleted a bunch (several hundred) of empty mail folders from a user account:
>> 
>> # doveadm mailbox status -u “user at example.com" messages "*" ALL | grep "=0" | awk -F= '{print $1}' | awk '{print "rm -rf ."$1}' > list
>> 
>> then I looked over list just to be sure it wasn’t mucked up and in the users root maildir:
>> 
>> # sh < list
>> 
>> and done.
>> 
>> I probably could do some research on how to combine those two awk pipes but this worked, and it was fast.
> 
> You may also want to *consider* removing those mailboxes from your subscriptions, too. I ran into this recently and IMAP considers the list of folders that exist and the list of folders that are subscribed to be separate entities.

Good point. I didn’t look at this for two reasons. 1) My mail client doesn’t;t support subscriptions 2) I was removing empty folders from a account that was acting as a backup for all the emails from a domain.

That said, it’s a good idea.


-- 
Apple broke AppleScripting signatures in Mail.app, so no random signatures.




More information about the dovecot mailing list