random-scripts/notmuch-pre.sh

18 lines
620 B
Bash
Executable File

#!/usr/bin/env zsh
local mail_root="$(notmuch config get database.mail_root)"
# copy-by-query <dest> [query...]
copy-by-query() {
for old_file in $(notmuch search --output=files not folder:Starred \
and not folder:Sent \
and not folder:Drafts \
and not folder:"${1}" and ${@:2}); do
local name="$(basename "${old_file}")"
local new_file="${mail_root}/${1}/cur/${name}"
cp "${old_file}" "${new_file}"
done
}
copy-by-query Starred tag:starred