Skip to content

Instantly share code, notes, and snippets.

@holly
Last active June 9, 2024 16:20
Show Gist options
  • Save holly/70c4f4052300ff5a48bce8df7adbd2aa to your computer and use it in GitHub Desktop.
Save holly/70c4f4052300ff5a48bce8df7adbd2aa to your computer and use it in GitHub Desktop.
Auto old mail spool file for SAKURA Internet Web Hosting Service
#!/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