Score:0

How to create subfolder on mailbox from command line

cn flag

On a CentOS 7 machine running Postfix and Dovecot how could I create subfolder named 'Bulk' on a inbox trough command line?

I thought to use the maildirmake command but this returns "maildirmake command not found".

Rob avatar
cn flag
Rob
Note that on Unix, BSD--and Linux, too--they are "directories" and not the Windows concept of "folders" which is not the same thing.
Score:0
cn flag

I've ended up using the doveadm mailbox create command to create additional folders in mailboxes. It creates the necessary cur, tmp and new subdirectories.

Score:0
cn flag
Bob

A Maildir is simply a directory that has the cur, tmp and new subdirectories.

IMAP Folders are usually simply subdirectories inside the main Maildir whose names start with a period, and which in turn are themselves Maildirs. They must also contain a zero-length file named maildirfolder. See http://www.courier-mta.org/maildir.html

That makes it trivial to create new folders with the mkdir command.

mkdir /path/to/Maildir/.Bulk
mkdir /path/to/Maildir/.Bulk/new
mkdir /path/to/Maildir/.Bulk/tmp
mkdir /path/to/Maildir/.Bulk/cur
touch /path/to/Maildir/.Bulk/maildirfolder

By making use of shell expansion you can reduce that to a single mkdir command:

mkdir -p /path/to/Maildir/.Bulk/{cur,tmp,new} 
touch /path/to/Maildir/.Bulk/maildirfolder

An IMAP subfolder is not nested in the parents Maildir folder, but represented as a directory on the some levels as the parent, with a name that starts with a leading dot . , the name of the parent folder, a second dot . and then the name of the sub folder, i.e. a subfolder "Serverfault" in you "Bulk" folder may look like:

mkdir -p /path/to/Maildir/.Bulk.Serverfault/{cur,tmp,new}
touch /path/to/Maildir/.Bulk.Serverfault/maildirfolder
anx avatar
fr flag
anx
Dovecot *can* be configured with this dot-notation for subfolders (and thus ensure some compatibility to certain other mail servers), but could just as well be configured to have each element of the path be a real filesystem folder.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.