vmail-stack/bin/vmail-purge.sh

32 lines
581 B
Bash
Raw Normal View History

2021-02-10 16:16:23 -08:00
#!/bin/bash
#
# vmail-stack
# https://git.stack-source.com/msb/vmail-stack
# MIT License Copyright (c) 2021 Matthew Saunders Brown
# load config
source /usr/local/etc/vmail.conf
accounts=(`find $VMAIL_DIR/*/ -mindepth 1 -maxdepth 1 -type d`);
dirs=('.Junk' '.Trash');
subdirs=('new' 'cur');
for account in "${accounts[@]}"; do
for dir in "${dirs[@]}"; do
for subdir in "${subdirs[@]}"; do
if [[ -d "$account/Maildir/$dir/$subdir" ]]; then
/usr/bin/find $account/Maildir/$dir/$subdir -type f -mtime +30 -exec rm -f {} +
fi
done
done
done