folderfilter & nametrans

tomasz.zok at gmail.com tomasz.zok at gmail.com
Sat Jan 19 15:48:25 GMT 2019


Sorry, I made a typo. It should be "import re" in the second point of
last section (not "import lib")

My example Python session to test your folderfilter looks like this:

    $ python
    Python 3.7.2 (default, Dec 29 2018, 21:15:15)
    [GCC 8.2.1 20181127] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import re
    >>> x = lambda folder: not re.search ('INBOX\.', folder)
    >>> x('.INBOX.Drafts')
    False


Regards,
Tomasz

On 2019-01-19 at 16:39, tomasz.zok at gmail.com wrote:
> Dear Francois,
> 
> the syntax is:
> 
>     folderfilter = lambda folder: ...
> 
> (you had "lambda" and "folder" switched)
> 
> 
> Second, your regular expression should be just 'INBOX\.'. Without
> a space character after INBOX and without parentheses.
> 
> 
> You can check these things by:
> - Running interactive python:
>   $ python
> - Importing regular expression lib:
>   import lib
> - Assigning your lambda of choice to a variable:
>   x = lambda folder: not re.search('INBOX\.')
> - Checking different inputs:
>   x('.INBOX.Drafts')
>   False
> 
> Regards,
> Tomasz
> 
> On 2019-01-19 at 15:38, Francois Sauterey wrote:
> > Sorry, I do not have to be the first one to ask this question (or a
> > similar one), but in the absence of a search engine on the archives, I
> > did not find any answer to my questions.
> > 
> > I just bought a new server, and I have to migrate my imap accounts from
> > old to new.
> > Here are the folders created by running offlineimap:
> > .&AMk-l&AOk-ments envoy&AOk-s
> > .&AMk-l&AOk-ments supprim&AOk-s
> > .Brouillons
> > .Courrier ind&AOk-sirable
> > .Drafts
> > .INBOX.Drafts
> > .INBOX.Junk
> > .INBOX.Sent
> > .INBOX.Trash
> > .Junk
> > .Sent
> > .Trash
> > cur
> > new
> > tmp
> > 
> > The first one contains sent messages (which should be in .Sent)
> > 
> > 1) I do not want to synchonize .INBOX.[Dratf | Junk | Sent | Trash] folders
> > So I addes this line in .offlineimaprc
> > folderfilter = folder lambda: not re.search ('(INBOX \.)', folder)
> > 
> > *but it does not work*
> > 
> > 2) I would like the messages in .&AMk-l&AOk-ments envoy&AOk-s to be
> > synchronized in .Sent
> > And no rule seems to work, without generating errors.
> > 
> > Can someone help me?
> > 
> > Best regards
> > Francois Sauterey
> > 
> > _______________________________________________
> > OfflineIMAP-project mailing list: OfflineIMAP-project at alioth-lists.debian.net
> > https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/offlineimap-project
> > 
> > OfflineIMAP homepages:
> > - https://github.com/OfflineIMAP
> > - http://offlineimap.org



More information about the OfflineIMAP-project mailing list