Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Server
User Name
Linux - Server This forum is for the discussion of Linux Software used in a server related context.


  Search this Thread
Old 04-03-2013, 05:50 PM   #1
LQ Newbie
Registered: Apr 2013
Posts: 1

Rep: Reputation: Disabled
Migrating mail server from debian 5 to debian 6- Maildir folder renaming script

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.
Old 04-05-2013, 07:46 AM   #2
Senior Member
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 3,250

Rep: Reputation: 1423Reputation: 1423Reputation: 1423Reputation: 1423Reputation: 1423Reputation: 1423Reputation: 1423Reputation: 1423Reputation: 1423Reputation: 1423
.INBOX is actually a folder, and .INBOX.whatever is the .whatever folder under the INBOX rather than as a folder under their user account. I'm not explaining this well, so a picture....

+-Foldername <- This would be .Foldername
++-INBOX <- This is .INBOX
 ++-Foldername <- This is .INBOX.Foldername
 |+--SubFoldername <- This is .INBOX.Foldername.SubFoldername
If you do your rename that you suggest this will flatten and move all the folders people have in their INBOX to outside their INBOX, and will probably break any rules in place.

Last edited by TenTenths; 04-05-2013 at 07:47 AM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: The Perfect Push Mail Server - Debian Squeeze (Debian 6.0) With ISPConfig 3 & Z-push LXer Syndicated Linux News 0 11-23-2012 09:30 AM
Mail delivered to /home/user/Maildir instead of /var/mail/vdomain/vuser/Maildir snowweb Linux - Software 1 08-16-2012 10:59 PM
Error Retrieving Mail from Linux Mail Server: Unable to Scan $HOME/Maildir tmghendi General 0 06-15-2009 08:35 AM
Migrating Mail - Courier Imap /Maildir > Cyrus /var/spool/imap swilliams2006 Linux - Server 3 10-13-2006 06:47 PM
Migrating a Debian Server from one System to another wodan39 Linux - Hardware 0 05-18-2005 04:44 PM > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 04:46 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration