24 lines
853 B
Bash
Executable File
24 lines
853 B
Bash
Executable File
#!/usr/bin/env sh
|
|
|
|
# The accounts to be cleaned
|
|
accounts="univ"
|
|
|
|
filter() {
|
|
notmuch search --output=files --format=text0 $parameters and tag:unread| xargs -0 --no-run-if-empty mv -t "$XDG_DATA_HOME/mail/$account/$tag/new/"
|
|
notmuch search --output=files --format=text0 $parameters and not tag:unread| xargs -0 --no-run-if-empty mv -t "$XDG_DATA_HOME/mail/$account/$tag/cur/"
|
|
}
|
|
|
|
for account in $accounts
|
|
do
|
|
notmuch tag --input $XDG_CONFIG_HOME/notmuch/tags/$account
|
|
tags_location="$XDG_CONFIG_HOME/notmuch/tags/$account"
|
|
tags="$(grep "+" "$tags_location" | sed -e 's/^.//' -e 's/ .*//')"
|
|
for tag in $tags
|
|
do
|
|
case $tag in
|
|
"+univ") ;;
|
|
*) parameters="folder:$account/INBOX and tag:$tag" && filter;;
|
|
esac
|
|
done
|
|
done
|