mpick piped into mrefile?

0 views
Skip to first unread message

Peter P.

unread,
Nov 29, 2025, 7:40:09 AM11/29/25
to mbl...@googlegroups.com
Hi list,

I am trying to copy or move all files older than a specific date from
one maildir to another and can't seem to get it right. If anyone has a
suggestion I'd be happy to hear it. Here is what I am trying:

mlist .imapMail_mbsync/fastmail/INBOX.Trash/ | mpick -t 'date < "2017-01-01"' | mrefile -k -v - mailbackupTest/

So far this only copie one or two messages instead of the many messages
displayed by just mlist piped into mpick with the same search terms:
mlist .imapMail_mbsync/fastmail/INBOX.Trash/ | mpick -t 'date < "2017-01-01"'

I am not using the example solution from mpick's manpage
mv $(mlist ./INBOX | mpick -t 'from =~ "@github"') ./github/cur
because I got advised on the mbsync mailing list that preserving "the
,U=nnn infixes of the files" is a very bad idea.

Thanks for all ideas!
cheers, Peter

Duncan Overbruck

unread,
Nov 29, 2025, 11:15:48 AM11/29/25
to Peter P., mbl...@googlegroups.com
> Peter P. <peter...@fastmail.com> hat am 29.11.2025 13:40 CET geschrieben:
> mlist .imapMail_mbsync/fastmail/INBOX.Trash/ | mpick -t 'date < "2017-01-01"' | mrefile -k -v - mailbackupTest/

I think the issue is the `-` in the mrefile argument.

> ‘-’ refers to the message read directly from the standard input.
https://man.voidlinux.org/mmsg.7

mrefile and most other tools will use the sequence from stdin or from the sequence file by default and the mmsg arguments are either selectors or in the case of - its a way to supply the actual mail instead of the path or a sequence of paths over stdin.

https://github.com/leahneukirchen/mblaze/blob/4b329452fcae2559597d6766139e087e4a125899/seq.c#L543-L550

Greetings,
Duncan

Peter P.

unread,
Nov 30, 2025, 3:25:21 AM11/30/25
to mbl...@googlegroups.com
* Duncan Overbruck <ma...@duncano.de> [2025-11-29 17:15]:
> > Peter P. <peter...@fastmail.com> hat am 29.11.2025 13:40 CET geschrieben:
> > mlist .imapMail_mbsync/fastmail/INBOX.Trash/ | mpick -t 'date < "2017-01-01"' | mrefile -k -v - mailbackupTest/
>
> I think the issue is the `-` in the mrefile argument.
>
> > ‘-’ refers to the message read directly from the standard input.
> https://man.voidlinux.org/mmsg.7

Thanks, yes! I am using the above command without the `-` now and it
seems to copy the respective messages, but prints
could not read sequence '/home/peter/.mblaze/seq': No such file or directory
What could be the reason for this error/warning?

Oh, and is there a way for mpicks condition to say "all email older than
N days" instead of providing an absolute date as condition?

Thanks again!
P

Peter P.

unread,
Dec 28, 2025, 10:15:18 AM12/28/25
to mbl...@googlegroups.com
* Peter P. <peter...@fastmail.com> [2025-11-30 09:25]:
> * Duncan Overbruck <ma...@duncano.de> [2025-11-29 17:15]:
> > > Peter P. <peter...@fastmail.com> hat am 29.11.2025 13:40 CET geschrieben:
> > > mlist .imapMail_mbsync/fastmail/INBOX.Trash/ | mpick -t 'date < "2017-01-01"' | mrefile -k -v - mailbackupTest/
> >
> > I think the issue is the `-` in the mrefile argument.
> >
> > > ‘-’ refers to the message read directly from the standard input.
> > https://man.voidlinux.org/mmsg.7
>
> Thanks, yes! I am using the above command without the `-` now and it
> seems to copy the respective messages, but prints
> could not read sequence '/home/peter/.mblaze/seq': No such file or directory
> What could be the reason for this error/warning?
I am replying to my own message here. It seems that creating an empty
~/.mblaze/seq file works around the above message. It would be nice if
its absence wouldn't spark the warning that an empty file will
circumvent.

> Oh, and is there a way for mpicks condition to say "all email older than
> N days" instead of providing an absolute date as condition?
It is possible, and I didn't RTFM properly, sorry. The below solution
works for eg. one year:
mpick -t 'date < "-365d"'

cheers, Peter

Leah Neukirchen

unread,
Jan 26, 2026, 9:04:26 AMJan 26
to Peter P., mbl...@googlegroups.com
"Peter P." <peter...@fastmail.com> writes:

> * Duncan Overbruck <ma...@duncano.de> [2025-11-29 17:15]:
>> > Peter P. <peter...@fastmail.com> hat am 29.11.2025 13:40 CET geschrieben:
>> > mlist .imapMail_mbsync/fastmail/INBOX.Trash/ | mpick -t 'date < "2017-01-01"' | mrefile -k -v - mailbackupTest/
>>
>> I think the issue is the `-` in the mrefile argument.
>>
>> > ‘-’ refers to the message read directly from the standard input.
>> https://man.voidlinux.org/mmsg.7
>
> Thanks, yes! I am using the above command without the `-` now and it
> seems to copy the respective messages, but prints
> could not read sequence '/home/peter/.mblaze/seq': No such file or directory
> What could be the reason for this error/warning?

This should only happen when there is a line in the input without "/",
so it tries to load the sequence file to look up the mail there.
Can you verify all lines contained a "/"?
(But what else should mlist print...)

--
Leah Neukirchen <le...@vuxu.org> https://leahneukirchen.org/
Reply all
Reply to author
Forward
0 new messages