X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;f=excluding.mdwn;fp=excluding.mdwn;h=9d8a5dd648000e22758920bdc42c434036250aa6;hb=4eec3beb80ff596ced2be515c64185c01903fb45;hp=0000000000000000000000000000000000000000;hpb=49f1adc3fb6fcce6754e637e24196ff55cce52e3;p=obsolete%2Fnotmuch-wiki
diff --git a/excluding.mdwn b/excluding.mdwn
new file mode 100644
index 0000000..9d8a5dd
--- /dev/null
+++ b/excluding.mdwn
@@ -0,0 +1,77 @@
+# Message exclusion and deletion
+
+An important principle of notmuch is that it does not modify your mail
+(with the one exception of
+[[maildir flag syncing|howto/#sync_maildir_flags]]). A question that
+frequently comes up, though, is how users can delete messages. While
+notmuch does not support, nor ever will, the deleting of messages,
+notmuch has a couple of nice features that allow users to handle
+excluding unwanted messages in a sensible way.
+
+## **message files**
+
+Notmuch makes it very easy to access the underlying mail files
+associated with specific search terms using the "file" output format
+of notmuch search. To find all message files associated with the tag
+"foo" rung:
+
+ $ notmuch search --output=files tag:foo
+
+This will output the paths to all message files with "tag:foo", one
+per line.
+
+This is useful in a number of different ways. For instance, it could
+be used to train a spam filter:
+
+ $ notmuch search --output=files tag:spam | sa-learn -f -
+
+It can also be used to purge mail files from disk:
+
+ $ notmuch search --output=files tag:deleted | xargs -l rm
+
+Make sure you run "notmuch new" after the last command so the database
+becomes aware that the files have been removed and can remove the
+corresponding entries from the index.
+
+##