diff options
author | John Denker <jsd@av8n.com> | 2012-07-18 12:37:10 -0700 |
---|---|---|
committer | John Denker <jsd@av8n.com> | 2012-07-29 15:32:33 -0700 |
commit | f426b21b6ab89d1e70fb4147ccb42fbd31b34969 (patch) | |
tree | b6ddc49fc6120193affdbcadbeb09d044cc993d7 | |
parent | b02174df1578e5d869001446815f461fb48589aa (diff) |
add "-r" (reverse) mode to mail-zap
-rwxr-xr-x | tools/mail-zap | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/tools/mail-zap b/tools/mail-zap index 912d740..4467ef6 100755 --- a/tools/mail-zap +++ b/tools/mail-zap @@ -1,13 +1,26 @@ #! /bin/bash -if test -z "$*" ; then +todo="" +verb="--spam" +dest="spam" + +for arg in "$@" ; do + case "$arg" in + -r) verb="--forget" + dest="new" + ;; + *) todo="$todo $arg" + esac +done + +if test -z "$todo" ; then exit fi -mail-scan +subject "$@" +mail-scan +subject $todo -sa-learn --spam "$@" +sa-learn $verb $todo -for file in "$@" ; do - mv "$file" "$(dirname $file)/../spam/" +for file in $todo ; do + mv "$file" "$(dirname $file)/../$dest/" done |