On Mon, 20 Jul 2009, Christian Ebert wrote:

> * lee on Monday, July 20, 2009 at 13:02:29 -0600
> > Thanks! But I don't know python --- I might try where I get to with a
> > bash script, maybe using find ... But now that I have the list, I
> > could try to keep them up to date.
> 
> The following could be a start, it came up in comp.mail.mutt:
> 
> mailboxes `find ~/Mail -type d \( \( -name cur -o -name new -o -name tmp \) 
> -prune -o -print \) \
>            | tr '\n' ' '`
> 
> (if your find has -printf you can get rid of the tr call)
> 
> It still lists directories that contain Maildirs, haven't found
> an elegant way to get rid of those. Personally I just use printf.

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

It produces a set of absolute paths, rather than a relative ones (%h is the 
path for the parent). 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.

I also knocked up a script that used a generic directory recursion routine 
and two functions - one that tested for maildir and one that printed the 
relative path. Can't remember why I switched. I could dig it out, but I'm 
sure there are infinitely superior Bash scripters on his list than me.

cheers, Adam
-- 
"...one cannot be angry when one looks at a penguin."
                                        - John Ruskin

Reply via email to