Cleaning up IMAP folder mess


I am not sure how, but my IMAP folders are a mess, with duplicate and recursive nested folders. For example: INBOX.INBOX.Sent, etc. I think it might have been connecting from multiple mail clients that may not have all had the IMAP prefix set correctly.

Generally, I use Apple’s on 2-3 different computers. When accessing via webmail, I use Squirrel Mail. Here are some screenshots of what Squirrel Mail shows as the folder hierarchy.

Can anybody explain why this happened (so I can avoid it in the future)? And also what is the best way to merge and clean things up? Eventually, I want to move this account to being hosted by gmail so I can use their webmail interface, although would be my primary email tool.

Thanks in advance.


can anybody help? or explain how imap prefixes work in general?