好的,认为这会起作用:
find /home/vmail/ -type d -path "*/*/Maildir/.LearnAsSpam/cur" -exec sh -c '(cd {} && mv ./* ../../.Junk/cur)' ';'
以防万一有人感兴趣,垃圾邮件学习和移动垃圾邮件的整个脚本如下所示:
# do a spam check in LearnAsSpam and LearnAsHam folders
# find spam
sa-learn -p ~/.spamassassin/user_prefs --spam /home/vmail/*/*/Maildir/.LearnAsSpam/{cur,new}
# find ham
sa-learn -p ~/.spamassassin/user_prefs --ham /home/vmail/*/*/Maildir/.LearnAsHam/{cur,new}
# move spam
find /home/vmail/ -type d -path "*/*/Maildir/.LearnAsSpam/cur" -exec sh -c '(cd {} && mv ./* ../../.Junk/cur)' ';'
find /home/vmail/ -type d -path "*/*/Maildir/.LearnAsSpam/new" -exec sh -c '(cd {} && mv ./* ../../.Junk/new)' ';'
# move ham
find /home/vmail/ -type d -path "*/*/Maildir/.LearnAsHam/cur" -exec sh -c '(cd {} && mv ./* ../../.Inbox/cur)' ';'
find /home/vmail/ -type d -path "*/*/Maildir/.LearnAsHam/new" -exec sh -c '(cd {} && mv ./* ../../.Inbox/new)' ';'
这已添加到 /etc/cron.daily/spamassassin 脚本中