need help with nametrans

myimap bdthatte at
Sun Sep 22 00:02:16 BST 2013

I downloaded my gmail with offlineimap following a very simple setup. I got
the following directories, and some more for labels. The folders for the
labels contained empty subfolders (cur, tmp, new).

[Gmail].All Mail  [Gmail].Drafts  [Gmail].Sent Mail  INBOX

I do not like these names so I moved the folders to gmail-all, gmail-sent,
gmail-inbox, and deleted other folders (which were empty anyway).

Moreover, I went to gmail (web interface) and removed all labels.

I then added the following lines in .offlineimaprc

folderfilter = lambda foldername: foldername in ['[Gmail]/All Mail',
'[Gmail]/Sent Mail']

nametrans = lambda folder: re.sub('INBOX$', 'gmail-inbox', 
		  re.sub('.*Spam$', 'spam', 
		  re.sub('.*Drafts$', 'drafts', 
		  re.sub('.*Sent Mail$', 'gmail-sent', 
		  re.sub('.*Starred$', 'flagged', 
		  re.sub('.*Trash$', 'trash', 
		  re.sub('.*All Mail$', 'gmail-all', folder)))))))

and re-ran offlineimap.

This time offlineimap downloaded again several thousand mails in gmail-all
and gmail-sent, and it seemed that it was duplicating thousands of mails.
For example, I noticed that ls -S shows 2 files of each size. 

Am I doing something wrong? (I don't understand exactly how the folderfilter
and nametrans are supposed to behave.

Also, how can I simply get either "all mail" in a single maildir or simply
"inbox" and "sent"? I would imagine that "all mail" is simply the union on
inbox and sent (and possibly bin).

Thank you for the help.

More information about the OfflineIMAP-project mailing list