User Tools

Site Tools


doc:appunti:linux:sa:offlineimap3_nametrans

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
doc:appunti:linux:sa:offlineimap3_nametrans [2024/03/22 11:15] – [offlineimap3 IMAP syncronization: nametrans] niccolodoc:appunti:linux:sa:offlineimap3_nametrans [2024/03/22 11:23] (current) – [The configuration file] niccolo
Line 69: Line 69:
  
 :!: **NOTICE**: The translated name of a sub-subfolder contains the original **directory separator** (.e.g. ''.Archives/2013''), this is OK because offlineimap3 is aware of the differencies in directory separator from the IMAP surce (the "/" is detected automatically) and the destination Mailird ("." is the default). So the destination folder is correctly created as ''.Archives.2013''. :!: **NOTICE**: The translated name of a sub-subfolder contains the original **directory separator** (.e.g. ''.Archives/2013''), this is OK because offlineimap3 is aware of the differencies in directory separator from the IMAP surce (the "/" is detected automatically) and the destination Mailird ("." is the default). So the destination folder is correctly created as ''.Archives.2013''.
 +
 +===== The configuration file =====
 +
 +This is the overall **offlineimap.conf** file:
 +
 +<file>
 +[general]
 +accounts = CopyFromIMAP
 +
 +[Account CopyFromIMAP]
 +remoterepository = OldServer
 +localrepository = NewServer
 +
 +[Repository OldServer]
 +type = IMAP
 +nametrans = lambda foldername: re.sub(r'^\.INBOX$', '', '.' + re.sub(r'^INBOX/', '', foldername.replace('.', '_')))
 +remotehost = mail.oldserver.com
 +remoteuser = username@oldserver.com
 +remotepass = MySecret
 +createfolders = False
 +
 +[Repository NewServer]
 +type = Maildir
 +localfolders = /home/username/Maildir
 +</file>
 +
 +Notice the ''createfolders = False'' for the source IMAP server. As explained above the syncronization is uni-directional from IMAP to Maildir, so we avoid to propagate directories backward.
 +
 +To run the command with some debugging:
 +
 +<code>
 +offlineimap -1 -c ./offlineimap.conf -d imap,maildir -l offlineimap.log
 +</code>
  
 ===== Web References ===== ===== Web References =====
doc/appunti/linux/sa/offlineimap3_nametrans.1711102556.txt.gz · Last modified: 2024/03/22 11:15 by niccolo