Remove empty milder folders

Darac Marjal mailinglist at darac.org.uk
Mon Jan 16 15:48:02 UTC 2017


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. The RFCs specifically say that deleting a folder 
should not invalidate the subscription (presumably because you might 
want to remain subscribed to it if it comes back). If you don't 
unsubscribe, then some MUAs will show your folders as "greyed out".

So, depending on what you're trying to do, you might want to "doveadm 
mailbox unsubscribe -u "user at example.com" $MAILBOX".

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

-- 
For more information, please reread.


More information about the dovecot mailing list