Merge the contents of two folders in thunderbird

2

1

I have two archive folders (folder A, and folder B) in different accounts, both are: Archives > 2016. These folders have very similar content, i.e., around 90% of the emails are identical; however, some are only present in A, and others only present in B.

I would like to merge both folders into one; A into B, or vice versa, it doesn't matter; but it is important no to duplicate those emails that are identical.

So far I have tried drag and drop from one to other but Thunderbird (or oneself) is not clever enough to ask what to do with the duplicate emails - it simply copies everything - duplicating the emails.

I run Thunderbird in Linux, so workarounds via CLI are more than welcome.

Javier Arias

Posted 2017-07-05T09:07:08.263

Reputation: 93

Answers

0

I had a similar problem.

The most efficient solution is the one you mentioned: move everything to the same folder, then remove duplicates.

I used an extension to operate the duplicate removal. An older extension with fewer features is also available, I chose to use the newest one. The extension I used can compare bodies and headers and also shows you a summary before operating the deletion. It also allows you to move the deleted duplicates to a specific folder.

I haven't tried from CLI, since this solution was so quick that I doubt it would have been efficient (for me) to look further.

FarO

Posted 2017-07-05T09:07:08.263

Reputation: 1 627

Both extensions seem to be quite old and require too much access: "Please note this add-on uses legacy technology, which gives it access to all browser functions and data without requesting your permission.". I'm not very comfortable granting extensions access to all my data, which also includes firefox. – Javier Arias – 2017-07-12T09:53:46.450

While I understand your skepticism, the source of the extension is on http://www.mozdev.org/source/browse/removedupes/src/ and quite easy to check. It looks like the author is not doing anything wrong with the data. Also, once used the extension can be disabled.

– FarO – 2017-07-12T11:28:32.223

0

This solution is theoretical and I haven't tried it.

If you move all the emails to a locally stored mailbox in Maildir format, you should have one file per email with all the headers and bodies.

At that point you can parse each file, printing to stdout the message ID and the filename. You sort that stdout, you extract the duplicates, you check the filesize (or further fields inside the file) and delete one of them if the criteria are met.

Since you are used to CLI handling stdout, sorting, finding duplicates and deleting files should be easy. If not, on this website you find all the answers.

FarO

Posted 2017-07-05T09:07:08.263

Reputation: 1 627