Last active
June 9, 2024 16:20
-
-
Save holly/70c4f4052300ff5a48bce8df7adbd2aa to your computer and use it in GitHub Desktop.
Auto old mail spool file for SAKURA Internet Web Hosting Service
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -e | |
set -u | |
set -o pipefail | |
set -C | |
MAILDIR=$HOME/MailBox | |
MTIME=30 | |
find $MAILDIR -type d -depth 1 | while read account; do | |
maildir="${account}/maildir" | |
trashdir="$maildir/.Trash" | |
spamdir="$maildir/.spam" | |
if [[ ! -d $trashdir ]]; then | |
continue | |
fi | |
if [[ ! -d $spamdir ]]; then | |
continue | |
fi | |
find $trashdir/{new,cur} $spamdir/{new,cur} -type f -mtime +${MTIME} | xargs --no-run-if-empty rm -frv | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment