Binary package “imapcopy” in ubuntu trusty
IMAP backup, copy and migration tool
IMAPCopy is a small command line tool to copy messages for multiple
users from one imap server to another. You can use it with any IMAP
implementation, for example you can migrate from Cyrus to MS Exchange
or from MS Exchange to Courier IMAP.
.
The package imapsync serves a similar purpose.