+[[!img notmuch-logo.png alt="Notmuch logo" class="left"]]
# Message exclusion and deletion
An important principle of notmuch is that it does not modify your mail
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:
+"foo" run:
$ notmuch search --output=files tag:foo
It can also be used to purge mail files from disk:
- $ notmuch search --output=files tag:deleted | xargs -l rm
+ $ notmuch search --format=text0 --output=files tag:deleted | xargs -0 --no-run-if-empty 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
you can delete them manually with:
$ notmuch search --output=files tag:deleted | xargs -l rm
+
+## <span id="exclude">**killing threads**</span>
+
+In a [[hook|manpages/notmuch-hooks-5]]
+
+ notmuch tag +muted $(notmuch search --output=threads tag:muted)"
+
+New messages in the thread get the muted tag. Make muted an excluded tag.
+To kill a thread, tag it with muted, run notmuch new.