summaryrefslogtreecommitdiff
path: root/dotfiles/Mail/.notmuch/hooks/pre-new
blob: db83fa48e36f2272443f650fe79572435d8727c6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/sh

# Delete mail
#notmuch search --output=files tag:deleted | xargs -rl rm

# Move marked spam to spam folder
notmuch search --output=files path:FSF/** AND NOT folder:FSF/INBOX.Spam \
        AND tag:spam | xargs -I '{}' mv '{}' ~/Mail/FSF/INBOX.Spam/cur

# Delete spam after one week
notmuch tag +deleted -- tag:spam AND date:..one_week

# Delete commits after one month
notmuch tag +deleted -- tag:commits AND date:..one_month

# Move mail from inbox to archive
notmuch search --output=files --duplicate=1 folder:WSU/INBOX AND NOT tag:inbox \
    | xargs -I '{}' mv '{}' ~/Mail/WSU/Archive/cur
notmuch search --output=files --duplicate=1 folder:FSF/INBOX AND NOT tag:inbox \
    | xargs -I '{}' mv '{}' ~/Mail/FSF/INBOX.Archive/cur

exit 0