On Aug 30, 2010 at 09:00 AM -0700, [email protected] wrote:
I have maildirs, a bunch of them, all under ~/Maildirs. I was hoping
to be able to use something like this:
I use a Python script to list my boxes. I'm sure you could do the same with
a shell script of shell command, but I'm more comfortable with Python.
In my muttrc, I have:
mailboxes `~/bin/listbox.py ~/Maildirs`
I've attached listbox.py. It has a list defined, ignore, that lets you
ignore certain folders if you wish. It works for Maildirs. I cleaned up
the code a bit for public consumption and removed some extra stuff that I
have it do.#!/usr/bin/env python
__author__ = "Tim Gray"
__version__ = "1.0"
import os, sys
try:
fpath = sys.argv[1]
except:
sys.exit(1)
tmp, parentdir = os.path.split(fpath)
# path to boxes to ignore, relative to input file path
ignore = ['.DS_Store', 'boxes', 'to', 'remove']
s = os.path.expanduser(fpath)
s1, s2 = os.path.split(s)
os.chdir(s1)
dirs = []
for root,wdirs,files in os.walk(s2):
if 'cur' in wdirs:
wdirs.remove('cur')
wdirs.remove('tmp')
wdirs.remove('new')
dirs.append(root)
# remove dirs to ignore
for i in ignore:
removedir = parentdir + '/' + i
if removedir in dirs:
dirs.remove(removedir)
# print out dirs
for i in dirs:
print '"+%s"' % i,