I have the same Problem with thunderbird on Linux.
It looks like thunderbirds imap-implementation is a little bit broken. Even if thunderbird tried once to get a mailbox, it persists in the profile.
I have FS-Layout in dovecot. Thunderbird somtimes try to get a submailbox with INBOX/firstlevel^secondlevel^thirdlevel
Then it doesn't find this mailbox on the server (for sure, it's INBOX/firstlevel/secondlevel/thirdlevel) tb tries to get next
INBOX/firstlevel^^secondlevel^^thirdlevel
and then INBOX/firstlevel^^^^secondlevel^^^^thirdlevel and so on. And on each first login, tb tries to get all of them again and again...
Go to $TB-profilefolder/ImapMail/ and delete all of the *.msf files and search for the wrong mailboxes, described above... you will finde them.
And they are probably also in some config-files in the profile. user.prefs i think, and panacea.dat i could find them.
Delete all of the entries (be careful). Close and restart firefox. Good look, the phantom-folders are gone.
jakob
I tried that. In addition to that I did Trash -> Context-Menu -> Settings and "Repair". I also deleted Trash.sdb and Trash.msf in ImapMail-Dir of given Mailbox (after closing Thunderbird of course and restart afterwards). I think the repair-button does more or less the same than deleting msf-files.
Trash was rebuilding... but the Folders are still there. I was able to get rid of some other "Junk folders" (that not even where shown in my Thunderbird-Trash inside Trash.sdb folder). But the folders causing current issue are still present after sync! And on server-side (vmail Mailbox on imap-server) these folders are also there!
I'm still not able to delete them in Thunderbird. Still getting error Folder contains children, delete them first". Obviously this isn't possible as those sub-folders are not shown in Thunderbird! On server-side of imap (vmail Mailbox) there are in fact sub-folders in those folders.
Best regards
Gabriel Kaufmann