Re: Slightly OT: I'm looking for a tool to merge maildirs

2022-01-25 Thread Chris Green
On Tue, Jan 25, 2022 at 12:02:34PM +0100, Marcus C. Gottwald wrote:
> 
> Chris Green wrote (Sun 2022-Jan-23 10:46:33 +):
> 
> > Both hierarchies will be on the same computer so it isn't an IMAP
> > synchronisation tool I'm looking for.  These are just directory trees
> > full of maildir mailboxes.
> 
> How about copying files on disk?
> 
> You could use "find" and/or "grep" to find the messages (= files);
> use hardlinks if you're sure that no message will be modified; use
> reflinks if the filesystem supports them; or simply copy from your
> current area to the archive again and again, if it's not too much
> data; use "fdupes" to remove duplicates (= identical content in
> differently named files) if there's a chance for duplicates being
> created.
> 
That's a point!

If I simply use rsync to copy my 'current' maildir hierarchy to the
'archive' hierarchy then only the newer files get copied, all the
older ones will already be there.  It might be worth running fdupes on
the archive occasionally but I don't think duplicates would be a big
problem, the occasional one won't matter anyway.

All I need to do then is delete files older than whatever date I
decide to 'archive' and the job's done!

-- 
Chris Green


Re: Slightly OT: I'm looking for a tool to merge maildirs

2022-01-25 Thread Marcus C. Gottwald


Chris Green wrote (Sun 2022-Jan-23 10:46:33 +):

> Both hierarchies will be on the same computer so it isn't an IMAP
> synchronisation tool I'm looking for.  These are just directory trees
> full of maildir mailboxes.

How about copying files on disk?

You could use "find" and/or "grep" to find the messages (= files);
use hardlinks if you're sure that no message will be modified; use
reflinks if the filesystem supports them; or simply copy from your
current area to the archive again and again, if it's not too much
data; use "fdupes" to remove duplicates (= identical content in
differently named files) if there's a chance for duplicates being
created.

Cheers, Marcus

-- 
   Marcus C. Gottwald  ยทยท  @mcg:cheers.de



Re: Slightly OT: I'm looking for a tool to merge maildirs

2022-01-25 Thread Cameron Simpson
On 24Jan2022 08:55, Chris Green  wrote:
>On Mon, Jan 24, 2022 at 10:24:41AM +1100, Cameron Simpson wrote:
>> On 23Jan2022 10:46, Chris Green  wrote:
>> >This is a bit off topic for mutt specifically but it's about doing
>> >things to the mail I read using mutt, so it's not *very* OT.  :-)
>>
>> Had you considered a shell script which invokes mutt with -e to copy
>> messages tagged by criteria from a mail folder to your archive folder?
>>
>That's a good idea, thank you.  I have done things like this before
>(i.e. an mbox to maildir script using mutt), not very fast but who
>cares, it can take some hours for all I care.
>
>I think it may need a separate process to de-duplicate the destination
>but that's OK.

If you're merging from several folders to the archive, I expect so. Mutt 
can do that, BTW. Order by threads, tags duplicates (~=) and delete 
them.

My folder hooks start like this:

folder-hook . 'push 
"~=~T"'

to do that: tag duplicates, delete (conditional on anything being 
tagged), untag tagged messages (~T).

Cheers,
Cameron Simpson