Re: Changing names of folders during sync.
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
On Mon, Sep 22, 2003 at 12:02:18AM +0100, Josef Karthauser wrote:
> Dear all,
> I want to change the names of some of the folders as they get
> synchronised locally. The sample config suggests:
>
> nametrans = lambda foldername: re.sub('^INBOX.', '', foldername)
>
> This will strip INBOX. off the beginning of each name. However I'd like
> to make a few more changes also and I don't know how to specify more
> than one change. Is this possible?
Yes. You can write arbitrary Python using the pythonfile arg (see the
PYTHONFILE CONFIGURATION FILE OPTION section in the manual.)
For example:
[general]
pythonfile=~/.offlineimap.py
[Repository foo]
namestrans = mytrans
In your ~/.offlineimap.py:
import re
def mytrans(foldername):
foldername = re.sub('^INBOX.', '', foldername)
foldername = re.sub('[a-z]', 'Q', foldername)
foldername[0] = 'R'
return foldername
Make sense?
-- John
|
|