<[EMAIL PROTECTED]> wrote:
>Is there *any* way I can get python to access maildirs
>which are not named using this (IMHO stupid) convention?

Well, the mailbox module doesn't support deleting mailboxes, so I'm not
sure why you want to use it.  Since you also seem to have a better idea
of what your maildirs look like, why not just use the lower level file
functions directly?  Something like:

        def remove_empty_maildir(dirname):
                expected = set(["cur", "new", "tmp"])
                ents = set(os.listdir(dirname))
                if ents != expected:
                        if expected.issubset(ents):
                                raise error, "unexpected subdirs in maildir"
                        raise error, "not a maildir"
                subdirs = [os.path.join(dirname, d)
                           for d in expected]
                for d in subdirs:
                        if len(os.listdir(d)) != 0:
                                return False
                for d in subdirs:
                        os.rmdir(d)
                os.rmdir(dirname)
                return True

Your case is presumably different somehow, so you'll have to update and
fix this completely untested code if you want to use it.

                                        Ross Ridge

-- 
 l/  //   Ross Ridge -- The Great HTMU
[oo][oo]  [EMAIL PROTECTED]
-()-/()/  http://www.csclub.uwaterloo.ca/~rridge/ 
 db  //   
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to