0

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".

Kaspar
  • 1
  • 2
  • Note that on Unix, BSD--and Linux, too--they are "directories" and not the Windows concept of "folders" which is not the same thing. – Rob Dec 10 '21 at 11:04

2 Answers2

1

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
Bob
  • 5,805
  • 7
  • 25
  • 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. – anx Nov 13 '21 at 13:49
0

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.

Kaspar
  • 1
  • 2