I am taking over the IT for the small business I work for and I inherited an older box running debian 5. Its sole purpose is just for our email server. I built a newer box with debian 6 on it an have been working on switching everyone over to the new server. I have all the courier imap and postfix installed and configured and working in my test environment for sending and receiving mail. I want the transition to be seamless so none of the users ever even know it happened (with the exception of them having to pull a new certificate). I am not super linux savvy and have ran into a small snag with this seamless transition.

Most of my users prefer mozilla thunderbird as their imap client of choice, and it works really well for us. Upon testing how thunderbird behaves when using the new server i noticed some of the users folders were not automatically showing up in thunderbird and had to be re-subscribed to. After digging into the old server a bit I noticed some users have folders in their mail directories named like this: ".INBOX.foldername.subfoldername" and others simply ".folder.subfoldername".

I noticed the problem of the subscribed folders not showing up in thunderbird only seems to happen for the users with folders having the ".INBOX" prefix. Using rsync i successfully copied everyones info to the new server. I don't have a large user group but they do have a ton of emails organized into a ton of folders and it would take forever for me to rename them by hand. Again not being super linux savvy, was wondering if someone could help me write a script that would go through and remove the "INBOX" prefix whilst maintaining the exact remainder of the foldername (which in some cases includes spaces) and any subfolders it may contain. Thanks in advance for the help.