su - zimbra

USER=thisoneuser
USER_DOMAIN=domain.com
DUMP_PATH=/mnt/zimbra2/backup/mailbox_archives
DATE=`date +%Y%m%d`

cd ${DUMP_PATH}

zmmailbox -z -m ${USER}@${USER_DOMAIN} getRestURL "//?fmt=tgz" > ${DUMP_PATH}/${USER}_${USER_DOMAIN}_${DATE}.tar.gz

And, to delete:

zmmailbox -z -m ${USER}@${USER_DOMAIN} emptyFolder /
/pre>
Advertisements