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