diff --git a/tagmail b/tagmail new file mode 100755 index 0000000..10c9928 --- /dev/null +++ b/tagmail @@ -0,0 +1,25 @@ +#!/usr/bin/env bash + +notmuch new + +folderlist=$(find ~/.mail/ -mindepth 1 -type d -printf '\n%P\n' | grep -v -E 'INBOX|Sent|Drafts|new|cur|tmp|notmuch' | sort) +folders="$(echo "$folderlist" | grep -v '\.') $(echo "$folderlist" | grep '\.')" +mailboxes="mailboxes" + +# Tag by folder +for folder in INBOX Sent Drafts $folders +do + mailboxes="$mailboxes \"+$folder\"" + tags=$(echo "${folder,,}" | tr -c '[[:alnum:]]' ' ' | sed -e 's/^ *//' -e 's/ *$//') + tagstring=+${tags// /" +"} + if [[ $folder != INBOX ]]; then + tagstring="$tagstring -inbox" + fi + #echo $tagstring + + notmuch tag $tagstring folder:"$folder" +done + +echo "$mailboxes" > ~/.mutt/mailboxes + +exit 0 diff --git a/tagmail2 b/tagmail2 new file mode 100755 index 0000000..e7f29d4 --- /dev/null +++ b/tagmail2 @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +notmuch search --format=text0 --output=files tag:killed | xargs -0 --no-run-if-empty rm