migrate older e-mails to local mailbox

17 views
Skip to first unread message

Tamas Papp

unread,
Nov 25, 2025, 3:20:08 AM11/25/25
to mu-discuss
Hi,

Gmail is bugging me about my mailbox getting full. I thought I would
migrate older (eg pre-2020) emails to a local mailbox (of course backed
up), and have mu index that too.

What would be the best way to do this (the migration, not the indexing;
I know how to do the latter ;-)). Is there a script I can use?

best

Tamas

Alberto Luaces

unread,
Nov 25, 2025, 9:02:11 AM11/25/25
to mu-discuss
From the very mu4e, I move those emails to a new mailbox folder (created on the
fly if needed, if I recall correctly) that is not synced.

You can test it with just one message, copying it first.

Tamas Papp

unread,
Nov 25, 2025, 9:13:07 AM11/25/25
to Alberto Luaces, mu-discuss
On Tue, Nov 25 2025, Alberto Luaces wrote:
Thanks, but I was hoping for a more automated solution (talking about
30k messages). Eg search for all messages before a given date in
mailbox, move them to a given folder.

best

Tamas

Alberto Luaces

unread,
Nov 25, 2025, 11:32:59 AM11/25/25
to mu-discuss
Yes, that's what I'm suggesting. You search them, you mark them, you
move them.

I only wrote about a simple test before you move those 30k messages.

Tamas Papp

unread,
Apr 2, 2026, 9:40:17 AMApr 2
to mu-discuss
Currently I am doing the following:

1. search for a particular year, eg with the query


2. mark all messages by pressing '*' (I could not find a way to
something-mark all messages in a query, is there one?)

3. e'x'ecuting the mark, and then specifying 'm' and the target folder.

If I create the target folder in my maildir, is it automatically
indexed? (that seems to be the case after moving).

Is there a way to make this more efficient, especially (2)?

Thanks,

Tamás

Dirk-Jan C. Binnema

unread,
Apr 5, 2026, 7:51:29 AMApr 5
to mu-di...@googlegroups.com
Hi Tamas,

On Thursday Apr 02 2026, Tamas Papp wrote:

> Currently I am doing the following:
>
> 1. search for a particular year, eg with the query
>
> 2. mark all messages by pressing '*' (I could not find a way to
> something-mark all messages in a query, is there one?)
>
> 3. e'x'ecuting the mark, and then specifying 'm' and the target folder.
>
> If I create the target folder in my maildir, is it automatically
> indexed? (that seems to be the case after moving).
>
> Is there a way to make this more efficient, especially (2)?

I think batch operations are best done outside mu4e; perhaps something
like the following to move all messages from 2010 to the archive folder

$ mu find date:2010..2010 --exec 'echo' | \
xargs -I {} echo "mu move {} /archive"

(this ^^ just echoes, use to test first...).

'mu move' also updates the index.

Kind regards,
Dirk.

--
Dirk-Jan C. Binnema Helsinki, Finland
e:dj...@djcbsoftware.nl w:www.djcbsoftware.nl
gpg: 6987 9CED 1745 9375 0F14 DA98 11DD FEA9 DCC4 A036

Tamas Papp

unread,
Apr 20, 2026, 10:42:19 AM (yesterday) Apr 20
to mu-di...@googlegroups.com
On Sun, Apr 05 2026, Dirk-Jan C. Binnema wrote:

> Hi Tamas,
>
> On Thursday Apr 02 2026, Tamas Papp wrote:
>
>> Currently I am doing the following:
>>
>> 1. search for a particular year, eg with the query
>>
>> 2. mark all messages by pressing '*' (I could not find a way to
>> something-mark all messages in a query, is there one?)
>>
>> 3. e'x'ecuting the mark, and then specifying 'm' and the target folder.
>>
>> If I create the target folder in my maildir, is it automatically
>> indexed? (that seems to be the case after moving).
>>
>> Is there a way to make this more efficient, especially (2)?
>
> I think batch operations are best done outside mu4e; perhaps something
> like the following to move all messages from 2010 to the archive folder
>
> $ mu find date:2010..2010 --exec 'echo' | \
> xargs -I {} echo "mu move {} /archive"
>
> (this ^^ just echoes, use to test first...).
>
> 'mu move' also updates the index.

Hi Dirk,

Thanks, this works splendidly on the local folders, but does not remove
the messages from my Gmail account.

Does mu move work the same way as deleting messages? (This question
betrays my lack of understanding about the intricaties of IMAP, sorry).

best

Tamás

Dirk-Jan C. Binnema

unread,
Apr 20, 2026, 2:54:09 PM (yesterday) Apr 20
to mu-di...@googlegroups.com
mu only knows about your local Maildir. How this Maildir is synchronized
(or not) with a remote mail-server depends on the intricacies of the
program you use for that... offlineimap or mbsync etc.

So best study the program you are using for that a bit, or ask here if
you have more details. Can't help you much (I don't use those programs)
except for remembering that with mbsync the '--change-name' option (for
'mu move') / mu4e-change-filenames-when-moving can be useful

[ I use good-old fetchmail, which just downloads
the messages and makes no attempt at synchronization; which is fine
for me ]

Good luck!

Tamas Papp

unread,
3:11 AM (18 hours ago) 3:11 AM
to mu-di...@googlegroups.com
On Mon, Apr 20 2026, Dirk-Jan C. Binnema wrote:

> mu only knows about your local Maildir. How this Maildir is synchronized
> (or not) with a remote mail-server depends on the intricacies of the
> program you use for that... offlineimap or mbsync etc.
>
> So best study the program you are using for that a bit, or ask here if
> you have more details. Can't help you much (I don't use those programs)
> except for remembering that with mbsync the '--change-name' option (for
> 'mu move') / mu4e-change-filenames-when-moving can be useful

I am using mbsync, but I am moving (with mu move) to a folder that is
_not_ managed by mbsync. I thought, perhaps naively, that when mu move
moves those messages, that would be equivalent to deleting them as far
as mbsync is concerned, and it would propagate the changes back to the
server.

I attach the relevant portion of my isyncrc in case anyone has a
suggestion.

best

Tamas
isyncrc
Reply all
Reply to author
Forward
0 new messages