#!/run/current-system/profile/bin/bash notmuch tag +work -- folder:/work/ notmuch tag +home -- folder:/home/ notmuch tag +receipt -- path:/home/Archive/Receipt/ notmuch tag +important -- path:/home/Archive/Important/ notmuch tag +ticket -- path:/home/Archive/Tickets/ notmuch tag +flight -- path:/home/Archive/Flight/ afew --tag --new notmuch search --output=files "path:/.*/INBOX/" tag:home and tag:deleted | while IFS= read -r f; do mv -v $f $(echo $f | sed 's/INBOX/Trash/' | sed 's/,U=[0-9]*:/:/'); done notmuch search --output=files "path:/.*/INBOX/" tag:home and tag:receipt and not tag:inbox | while IFS= read -r f; do mv -v $f $(echo $f | sed 's/INBOX/Archive\/Receipt/' | sed 's/,U=[0-9]*:/:/'); done notmuch search --output=files "path:/.*/INBOX/" tag:home and tag:flight and not tag:inbox | while IFS= read -r f; do mv -v $f $(echo $f | sed 's/INBOX/Archive\/Flight/' | sed 's/,U=[0-9]*:/:/'); done notmuch search --output=files "path:/.*/INBOX/" tag:home and not tag:inbox | while IFS= read -r f; do mv -v $f $(echo $f | sed 's/INBOX/Archive/' | sed 's/,U=[0-9]*:/:/'); done # work notmuch search --output=files "path:/.*/INBOX/" tag:work and tag:deleted | while IFS= read -r f; do mv -v $f $(echo $f | sed 's/INBOX/\[Gmail\]\/Trash/' | sed 's/,U=[0-9]*:/:/'); done #notmuch search --output=files "path:/.*/INBOX/" and tag:work and not tag:inbox | while IFS= read -r f; do mv -v $f $(echo $f | sed 's/INBOX/\[Gmail\]\/All Mail/' | sed 's/,U=[0-9]*:/:/'); done