On Tue, 21 Jul 2009, Christian Ebert wrote: > * Adam Wellings on Tuesday, July 21, 2009 at 11:17:09 +0100 > > I have a folder hierarchy of maildirs, though only the nodes (or leaves) > > are > > actually maildirs, eg: > > > > fol2 > >| -Fol2 > >|| -maildira > >|| -maildirb > >| -Fol3 > >|| -Fol4 > >||| -maildirc > >||| -maildird > >|| -maildire > >| -Fol5 > >|| -etc.. > > > > This mailboxes command works for me: > > > > mailboxes `find /path/to/mail -type d -name cur printf '%h '` >
Firstly sorry, I missed the '-' off printf > Sure, but (my find doesn't have printf): > > ~$ time find ~/Mail -type d -name cur -execdir pwd \; > /dev/null > > real 0m54.973s > user 0m0.447s > sys 0m54.159s > ~$ time find ~/Mail -type -d \( \( -name cur -o -name new -o -name tmp \) > -prune -o -print \) > /dev/null > find: -type: -d: unknown type > > real 0m0.401s > user 0m0.001s > sys 0m0.011s Thanks for that, I've created this command based on the above: mailboxes `find ~/Mail -type d \( \( -name cur -o -name new -o -name tmp \) -prune -o -printf '+%P ' \)` It's cut the time from ~1s to ~0.3s. If the set of maildirs rarely changes, would it be faster to generate a file and just source that in your .muttrc? I can't do that as I use procmail to sometimes create new maildirs in some situations. Also, I've looked up why my script is no longer used, it took ~8-9s to produce the list. I'm sure it could be improved upon generally, but as find does the job, it'd purely be an academic exercise. Cheers, Adam