On Fri, Sep 08, 2006 at 04:57:08PM +0100, Kevin Philp wrote:
> I have a small office where people have been using Kmail for the last five
> years. They are well organised and have all sorted their years of email into
> directories/sub directories and have happily accumulated thousands of emails.
>> Now we want to offer them access to their mail while travelling so I want to
> migrate to Dovecot so they can access their mail via imap. I can copy email
> from local files to imap in Kmail but it won't copy directories. Also I
> looked at the Kmail directory setup and it doesn't lend itself to worknig
> with Dovecot.
>> can someone point me in the direction of a wee perl script or similar that
> will run through each users Kmail directories and copy them to something hat
> is easier for Dovecot to understand?
Dovecot requires the maildirs to be in the "root" of the users's mail
home with subdirs seperated by periods. The directory name must also
start with a period for dovecot to pick it up. Everything bar the inbox
must be maildir.
A script I wrote to do the maildir name mangling (bidirectional symlinks):
#!/bin/bash
#Brian Brazil <bbrazil at netsoc.tcd.ie> 2005
cd $HOME/Maildir/ || exit 1
#~/Maildir/blah <- ~/Maildir/.blah
for i in $( find -mindepth 1 -type d -and -not \( -name 'cur' -or -name 'new' -or -name 'tmp' -or -name '.*' \) ); do
[ -d "$i/cur" -a -d "$i/tmp" -a -d "$i/new" ] || continue
link=$(echo "$i" | sed 's/^\.//; s#/#.#g');
[ -e "$link" ] && echo "$i: $link already exists" && continue
echo "linking $link to $i"
ln -s "$i" "$link"
done
#~/Maildir/.blah <- ~/Maildir/blah
for i in $( find -mindepth 1 -maxdepth 1 -type d -name '.*' -and -not \( -name 'cur' -or -name 'new' -or -name 'tmp' \) ); do
[ -d "$i/cur" -a -d "$i/tmp" -a -d "$i/new" ] || continue
link=$(echo "$i" | sed 's/^\.\/\.//;');
[ -e "$link" ] && echo "$i: $link already exists" && continue
echo "linking $link to $i"
ln -s "$i" "$link"
done
Brian
--
Website: http://www.netsoc.tcd.ie/~bbrazil
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!