~eddsalkield/edd.salkield.uk

28887dc8624301c13a8a7ef4ac9ea16b08619468 — Edd Salkield 2 months ago f80471f
blog: new post deduplicating mbsync maildir
1 files changed, 5 insertions(+), 6 deletions(-)

R content/blog/{_2022-10-14-deduplicating_your_mbsync_maildir.md => 2022-11-09-deduplicating_your_mbsync_maildir.md}
R content/blog/_2022-10-14-deduplicating_your_mbsync_maildir.md => content/blog/2022-11-09-deduplicating_your_mbsync_maildir.md +5 -6
@@ 1,6 1,6 @@
---
title: "Removing duplicate emails from an mbsync maildir"
date: 2022-10-14
date: 2022-11-09
---

I use [mbsync](https://drewdevault.com/2021/05/17/aerc-with-mbsync-postfix.html) to synchronise my emails between [my mail provider](https://www.migadu.com/) and my various computers.


@@ 88,7 88,7 @@ $ find ./ -type f -exec sed -i -e '/X-TUID/d' {} \;

Run `rmlint` to check for duplicates.
If you don't have `rmlint`, now would be a good time to install it with your system package manager.
I've [packaged it for Alpine](TODO), and it seems to be fairly available.
I'm [packaging it for Alpine](https://gitlab.alpinelinux.org/alpine/aports/-/merge_requests/41202), and it seems fairly available across [various distros](https://repology.org/project/rmlint/versions).
Failing this, you can simply [compile it yourself](https://rmlint.readthedocs.io/en/latest/install.html#compilation) - it's not too hard!

We supply the `-g` flag to get a nice progress bar.


@@ 186,17 186,16 @@ go!
Now would be a good idea to check your mailbox to ensure it's all okay now!

Finally, sync with mbsync.
`--expunge-far` should be enabled (or its equivalent in the `mbsync` config file) to ensure that your locally deleted emails get deleted on the far side as well.
`--expunge-far` should be enabled (or its equivalent in the `mbsync` config file) to ensure that your locally deleted emails get deleted on the far side as well[^3].

```
$ mbsync -a --expunge-far
C: 0/3  B: 9/11  F: +0/0 *0/0 #0/0  N: +0/0 *0/0 #0/0
```

You might notice that you get some errors about the near side box not existing.
If that's the case, feel free to use [my other guide](TODO) to fix this up.

And breathe!

[^1]: Speaking of which, if anyone knows what this header really does, I'd love to know - there's very little information about it online.
[^2]: This code snippet claims to help: [https://gist.github.com/lewisthompson/bb0e0399254c90cf36dba03956bd2ff0](https://gist.github.com/lewisthompson/bb0e0399254c90cf36dba03956bd2ff0) and there's a discussion on this mailing list: [https://groups.google.com/g/mu-discuss/c/SqMOZSouh0Y](https://groups.google.com/g/mu-discuss/c/SqMOZSouh0Y)
[^3]: You might notice that you get some errors about the near side box not existing.
If that's the case, you need to recreate those mail boxes in your maildir, and resynchronise the mail into it. I plan to write a future post about this topic.