Manually Create maildir Folders

Operating System & Version
AlmaLinux v8.7.0 STANDARD
cPanel & WHM Version
106.0.15

Justin Waters

Registered
Feb 2, 2023
3
1
3
USA
cPanel Access Level
DataCenter Provider
I was surprised to find no one asking for the same thing here.

Every inbox we are migrating from mDaemon to cPanel we are having to manually recreate the folder structure. It doesn't work to create the .folderdir even if we create the /cur /new /tmp folders it doesn't generate the rest of the maildir files to support it.

Is there any way to batch generate these folders? Our problem is migrating 50k mail boxes all with ~10 folders and some with sub-sub-folders. You can imagine how tedious it is to go through each mailbox and manually recreate the folder structure and then drag the messages over for each box.
 

Justin Waters

Registered
Feb 2, 2023
3
1
3
USA
cPanel Access Level
DataCenter Provider
Accounts are being created via cPanel. The issue is that right now we have to log into the user's webmail then go to Settings > Folders > Create to add each folder.

Many accounts have 5-10 folders and a good amount of those have sub folders. The issue is multiplied by about 50,000 so you can imagine why manually creating each folder manually this way for each user is a problem.

Is there any API, command line, or anything available to automate this?
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
15,218
2,417
363
cPanel Access Level
Root Administrator
What about doveadm commands directly? Those would look something like this:

Code:
doveadm -u [email protected] mailbox create INBOX.folder
and a loop could be created to loop through all the users you'd like as part of a script.

Additional examples can be found here:

 
  • Like
Reactions: Justin Waters