exclude a list of imap folders.

Pablo Olmos de Aguilera C. pablo.olmosdeaguilera at gmail.com
Mon Jan 7 02:03:24 GMT 2013


Uwe Brauer <oub <at> mat.ucm.es> writes:

>
> Hello
>
> I know to exclude one folder on a imap server with
>
> folderfilter = lambda folder: folder.startswith('[Gmail]/All Mail')
>
> But suppose I want to exclude a list of folders,
> shall I add more lines like
>
> folderfilter = lambda folder: folder.startswith('[Gmail]/All Mail')
> folderfilter = lambda folder: folder.startswith('[Gmail]/Attachments')
>
> Or is only the last line of folderfilter the relevant one
> and the others are overwritten?

Afaik only one of them works. I'm not sure if the first or the last, but
hey; a very simple way to do it is to check with the --info parameter to
the cli:

$ offlineimap -o -1 --info

It will show a list of every nametrans, adding a `(disabled)` after the
remote folder.

> Shall I then use a list as in
>
> folderfilter = lambda folder:
> folder.startswith('[Gmail]/All Mail','Attachments')

Didn't mean to RTFM, but did you read this?
http://docs.offlineimap.org/en/latest/nametrans.html#folderfilter

I rather do something like:

folderfilter = lambda folder: folder not in [ '[Gmail]/Trash'
                                            , '[Gmail]/Important'
                                            , '[Gmail]/Spam'
                                            ]

Another approach, could it be do something like this:

https://github.com/pbrisbin/mutt-config/blob/master/examples/offlineimaprc

(check the nametrans.py file too!)

> Thanks

Hope it helps (your mail it's a month old)






More information about the OfflineIMAP-project mailing list