How do you handle archiving old mails in your maildir?
#!/usr/bin/env zsh where=(--where .) zparseopts -K -E -D -A opts '-where:=where' -days: if [[ -z ${opts[--days]} ]]; then opts[--days]=30 fi opts['--days']=30 if [[ $# != 2 ]]; then cat <<EOUSAGE >&2 Usage: $0 [options] from to Moves old emails Options: --where PATH Path to move emails from; that is, move <from>/PATH/x/y/z to <to>/PATH/x/y/z If omitted, assumes '.': every email inside <from> will be moved EOUSAGE exit 1 fi from=$1 to=$(realpath $2) cd $from echo find $from -type f -mtime "+${opts[--days]}" -print find ${where[2]} -type f -mtime "+${opts[--days]}" -print | while read f; do mkdir -p $(dirname $to/$f) mv $f $to/$f done
And then I run archive_maildir.sh ~/Mail ~/Mail/Archive --where folder_I_want_to_archive --days 15
NOTE: my setup is ~/Mail is indexed by notmuch; ~/Mail/accountname for each account I have. Moving the mail to ~/Mail/Archive/ does not create any problem to notmuch.