* 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 '`

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

> It produces a set of absolute paths, rather than a relative ones (%h is the 
> path for the parent).

No problem if you have $folder set.

> It also relies on no, non-maildir folder having a 
> sub-directory of "cur", but that's a minor point. I think I have a  
> different/better method on my home machine, but as I'm at work (this is a 
> Cygwin installation), I can't look that up at the moment.

Personally I also want to *exclude* certain nodes/leaves and
mailboxes, which is why I always end up with simple printf:

mailboxes "!"
mailboxes `printf ' %s' ~/Mail/[a-z-]* ~/Mail/[^ANa-z-]*/[^_]*`

That's because my setup doesn't change (I know I don't have
hierarchies deeper than 2) and I've imposed some conventions,
like starting the nodes' names with a capital letter.

The corresponding, slightly more flexible find command (for my
setup):

mailboxes `find -E ~/Mail -type d \( \( -name cur -o -name new -o -name tmp \) \
           -prune -o ! -regex '.*/([A-Z_][a-z]*|(Archive|News)/.*)' -print \) \
           | tr '\n' ' '`

c
-- 
  Was heißt hier Dogma, ich bin Underdogma!
[ What the hell do you mean dogma, I am underdogma. ]
_F R E E_  _V I D E O S_  http://www.blacktrash.org/underdogma/
                          http://www.blacktrash.org/underdogma/index-en.html

Reply via email to