* Dmitry Marakasov on Monday, March 26, 2012 at 21:12:24 +0400
> I have mutt set up to generate a list of mailboxes on the startup
> automatically (in a way similar to what is written under `Building
> a list of "mailboxes" on the fly' of http://wiki.mutt.org/?ConfigTricks).
> This is really convenient as I have many mailboxes which are created
> automatically with procmail, however with time it becomes uncomfortably
> slow, as find(1) has to stat()'s each file it encounters, and that
> includes all the mail message files, while in my case there're 250k
> of them. -maxdepth option of find won't help either, as I have
> maildirs on a different levels of filesystem hierarchy.

Not if you play around with find's -prune option:

mailboxes `$SHELL -c "\`find ~/Maildir -type d \( -name cur -o -name tmp -o 
-name new -execdir pwd \; \) -prune \`"`

which can be further simplified if your find provides -printf.

> To fix that, I've written a simple utility which I'd like to announce.
> The utility traverses a directory hierarchy and prints names of
> mailboxes (maildirs) it finds in mutt-compatible format. Unlike
> find(1) method documented in the wiki it does not descend into
> maildirs themselves, thus is a lot faster.
> 
>  Invocation:
> $ findmaildirs ~/.mail
> +inbox +archives/foo +archives/bar +maillists/freebsd/ports
> +maillists/freebsd/announce +maillists/lkml ...
> 
>  Using in mutt:
> mailboxes `findmaildirs ~/.mail`
> 
>  GitHub project page:
> https://github.com/AMDmi3/findmaildirs
> 
>  FreeBSD port:
> http://www.freshports.org/mail/findmaildirs
> 
>  OpenSUSE build service page with some RPMs:
> https://build.opensuse.org/package/show?package=findmaildirs&project=home%3AAMDmi3

-- 
Python Mutt utilities --->> https://bitbucket.org/blacktrash/muttils

Reply via email to