[Dovecot] valid folder name

Jan-Frode Myklebust janfrode at tanso.net
Wed Jun 5 15:44:25 EEST 2013

We have a quite large user base, with lots of bad folder names because
the mail folders was earlier accessible outside of dovecot. Now we're
running dsync conversions from maildir to mdbox for all users, but are
struggelig a bit with dsync not liking invalid folder names.

Before we convert a user we try to determine if the folder names are
valid, but we don't have a very good regexp for validating it. Maybe
someone else knows a way to verify (and fix?) folder names that are

The rules I know is:

 - name doesn't start with '.' or '~' (after the initial '.')
 - name doesn't end with '.'
 - the name doesn't contain '..'
 - the name is valid mUTF7

So, any regexp gurus that can distill those rules down to something


    Some people, when confronted with a problem, think "I know, I'll use
regular expressions." Now they have two problems. -jwz

More information about the dovecot mailing list