Note: if the following is too technical for you, please contact me. So far I had little incentive to make these scripts more friendly for the casual user.
The scripts on this page use the UW IMAP C-Client library to copy mailbox hierarchies. Mailboxes are addressed using the naming conventions used in the C-Client library.
Usage:
iicopy.pl source destination destination-folder
where source and destination are C-Client mailbox names and destination-folder is the name of the folder into which source will be copied. For example,
iicopy.pl '{imap1.yourdomain.com/user="username"}INBOX' \
'{imap2.yourdomain.com/user="otheruser"/ssl/novalidate-cert}INBOX' \
TRANSFER
will copy INBOX (including subfolders) from imap1.yourdomain.com to INBOX.TRANSFER on imap2.yourdomain.com.
The CGI interface allows to run iicopy on the web server, providing the output of the command-line script via the web and by an email upon job completion. You need to adapt the script to your local setup; it is castrated in order to avoid it being used for attacks on other systems; also change the email address etc. If there is enough interest, I will make these things more easy to customize. Also note that the script leaves the session files in $TMPDIR/iicopy-cgi-* so you need to manually clean them up (e.g., expire sessions by a small cron job that deletes all iicopy-cgi-* files that haven't been written to or read from for a specified time).