[imapfilter-devel] Using imapfilter to migrate IMAP folders

Lefteris Chatzibarbas lefcha at hellug.gr
Fri Sep 12 12:53:39 EEST 2003


On Thu, Sep 11, 2003 at 10:14:04AM -0400, Brian Long wrote:
> Hello,
> 
> I would like to know if there is a way for imapfilter to migrate 50+
> IMAP folders from one IMAP server to another.  I would like it to scan
> the source host, figure out all the folders and hierarchy, create the
> same folders and hierarchy on the destination host and move all the
> email.
> 
> Is that possible?

Not exactly like you describe the migration procedure.  You will have
to manually specify all the mailboxes that reside in the source IMAP
server (see the "folder all ..." line below).  A possible configuration
file to do the job:

--BEGIN--
account src user:pass at server.src
  folder all mbox1,mbox2,foo/bar,foo/qux

account dst user:pass at server.dst

filter migrate
action rcopy dst $_

job migrate all
--END--

You could also do "rmove" instead of "rcopy", but "rcopy" and then
"delete" is the safer solution (if all have gone well you then run a
"delete" filter through all the mailboxes of the source IMAP server).

NOTE: You MUST apply the attached patch against imapfilter 0.9.2
to do rcopy/rmove with the default variable "$_".  I will release
0.9.3 soon with this correction included.  Patch like this:

  tar zxf imapfilter-0.9.2.tar.gz
  patch < patch-0.9.2-1


-------------- next part --------------
diff -ruN imapfilter-0.9.2.orig/action.c imapfilter-0.9.2/action.c
--- imapfilter-0.9.2.orig/action.c	Fri Aug  8 15:54:48 2003
+++ imapfilter-0.9.2/action.c	Fri Sep 12 12:32:36 2003
@@ -244,6 +244,7 @@
 	m = mcp = xstrdup(mesgs);
 
 	xstrncpy(dm[1], destmbox, MBOX_NAME_LEN - 1);
+	default_variables(mbox, dm[1]);
 	current_date(dm[1]);
 
 	tok = strtok_r(m, " ", &m);


More information about the Imapfilter-devel mailing list