[Dovecot] Maildirmake equiv?
LuKreme
kremels at kreme.com
Fri Aug 16 07:53:05 EEST 2013
Since I am using dovecot I do not have courier installed, but Courier had a very handy tool for making maildir folders called `maildirmake` which I used in some automated backup scripts. How do I duplicate maildirmake in dovecot?
for example:
#!/bin/bash
# v1.2a Testing for new dovecot install
# Archive mail from folders without [0-9]{4} Maildirs
# after they are 21 days old to a yearly folder
MDIR="$HOME/Maildir"
MDM="/usr/local/bin/maildirmake"
YEAR=`/usr/local/bin/gdate -d "last month" '+%Y'`
echo "The Year is $YEAR..."
OIFS=$IFS
IFS="
"
for I in `find $MDIR -maxdepth 1 -mindepth 1 -type d| egrep -v "[0-9][0-9][0-9][0-9]"`; do
MYDIR="${I}"
TBASE=`basename $MYDIR`
# if [ ! $TBASE == "Maildir" ]; then
TDIR=`dirname $MYDIR`
TARGET="${TDIR}/.zz${TBASE}.${YEAR}"
# echo "$MYDIR $TARGET"
if [ -d "$MYDIR/cur" ]; then
echo -n "Processing ${MYDIR} => ${TARGET}..."
if [ ! -d "${TARGET}" ]; then
echo ""
echo -n "WARNING ${TARGET} does not exist. invoking $MDM ${TARGET}..."
$MDM "${TARGET}"
fi
if [ -d "${TARGET}" ]; then
# echo "$TARGET does exist, moving files"
find ${MYDIR}/cur -type f -ctime +21 -exec mv {} ${TARGET}/cur/ \;
echo "done."
else
echo "$TARGET does not exist"
fi
fi
# fi
done
IFS=$OIFS
--
Forever was over. All the sands had fallen. The great race between
entropy and energy had been run, and the favourite had been the winner
after all. Perhaps he ought to sharpen the blade again? No. Not much
point, really.
More information about the dovecot
mailing list