Are there any good maildir manipulation utilities out there?
Cameron Simpson
cs at cskk.id.au
Thu Apr 8 21:58:12 UTC 2021
On 08Apr2021 08:40, Chris Green <cl at isbd.net> wrote:
>On Thu, Apr 08, 2021 at 08:43:48AM +1000, Cameron Simpson wrote:
>> It's also not particularly well suited
>> to Chris' requirement, which includes preserving the source tree shape
>> in the archiving process.
>>
>Yes, that was just one typical requirement. The other major
>requirement is rather different. I have (for example) lots of
>messages about orders from Screwfix which are currently spread around
>in various sub-directories of 'shopping'. For suppliers like Screwfix
>from whom I buy a lot of rather mixed up sort of items it now makes
>sense to me to keep them all in a Screwfix directory. So the
>requirement is to find all messages from Screwfix and put them in one
>directory.
Note that there's no fundamental reason you can't link the same message
into many Maildirs. So link them all into a screwfix folder, and also
where they naturally land courtesy of other filing rules.
Also, didn't you put some work into tagging messages. A search on
tag=screwfix might go well.
>> I suspect Chris may need to roll his own. I'd imagine something like:
>>
>> find message paths using mairix \
>> | move message files sideways, making sure there's no conflicts
>>
>Yes, I think it may have to be a roll my own something like this.
>It's just that mairix doesn't provide a very good 'handle' to use.
I'm using notmuch. In particular, this:
notmuch search --output=files -- search terms ...
emits message pathnames. That gets you the folder structure with alittle
path fiddling. So my "notmuch-search" script (aliased as "++") goes:
if [ $dothreads ]
then
notmuch search --output=threads -- "$@" \
| while read -r tid
do notmuch search --output=files -- "$tid"
done
else
notmuch search --output=files -- "$@"
fi \
| egrep '/(new|cur)/[^/]+$' \
| sort -u \
| xxargs arg1 -end "$mdir/new" set-x ln -i -s \
at the bottom:
- find the messages
- winnow some noise - probably unnecessary
- "sort -u" to remove duplicates
- make symlinks to all the messages in the search result maildir's "new"
subdir
Then it fires up mutt on the result maildir.
I would think you could shoehorn the above logic a bit to achieve your
"keep the hierachy shape" thing.
Cheers,
Cameron Simpson <cs at cskk.id.au>
More information about the Mutt-users
mailing list