On 22Jan2022 21:26, Chris Green <c...@isbd.net> wrote:
>So I need to test whether a point I have reached in the hierarchy is a
>maildir mailbox or not.  Using mbox format it's easy because 'folders'
>are directories and mailboxes are files.  However with maildir the
>'folders' have directories within them so the simple tree walking goes
>down a level too far and finds 'folders' which aren't mailboxes called
>'cur', 'new' and 'tmp'.
>
>Is there any 'ready made' way in python to tell whether a directory is
>a maildir mailbox?  If not I suppose I'll simply have to check if
>there are 'cur', 'new' and 'tmp' directories within the directory
>which may or may not be a maildir.

I was hoping that the provided mailbox/Maildir class had something, but 
apparently not.

So I suggest fetching my cs.mailutils module from PyPI and using its 
ismaildir(path) function, which does exactly what you describe.

Cheers,
Cameron Simpson <c...@cskk.id.au>
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to