random-scripts/notmuch-pre.sh

18 lines
620 B
Bash
Raw Normal View History

2023-05-26 06:36:05 -07:00
#!/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