On Thu, 2002-10-17 at 08:40, Robert M. Meyer wrote:
> I installed UW-IMAP with the maildir patches on my system but there are
> several bizarre problems. I intend to convert to Courier (tested it on
> a development server) but I have to convert all of my users from one
> maildir format hierarchy to the Courier hierarchy.
I think that the attached script will convert all of your folders
appropriately.
#! /bin/sh
scan_maildirs_in () {
local WD=$1
local PREFIX=$2
local x
pushd $WD
for x in * ; do
if [ "$x" = "Maildir" -o "$x" = "new" -o "$x" = "tmp" -o "$x" = "cur" ] ; then continue ; fi
if test -d "$x" -a -d "$x/new" -a -d "$x/tmp" -a -d "$x/cur" ; then
scan_maildirs_in "$x" "$PREFIX.$x"
newx="`echo $x | sed -e 's/\./,/g'`"
echo mv "$x" $homedir/Maildir/"$PREFIX.$newx"
fi
done
popd
}
awk -F: '{ if($3 >= 500){print $6}}' < /etc/passwd | \
while read homedir; do
pushd $homedir
## Don't convert this user if there's already a "Maildir" folder
#test -d Maildir && continue
## Only convert if this user has an INBOX
#test -d INBOX || continue
echo mv INBOX Maildir
scan_maildirs_in $homedir
popd
done