A source that files one message in several folders -- IMAP and Maildir copies, Gmail labels -- leaves one archive row per folder, all pointing at the same blob. Export imported each row on its own, so the message arrived on the target once per folder. Worse, an interrupted export matched the rest by Message-ID alone on the next run and skipped them, so their folders were never added. Export now folds rows with the same blob into one email, with the union of their folders and keywords. On a match it adds, with one batched Email/set, any migrated folder the target copy is missing; folders that exist only on the target are left alone. Matching is still by Message-ID (or the fallback digest), with size deciding between several messages that share one, so two different messages are never folded onto one target email. The archive is unchanged: the fold happens at export, so imports, resumes and deletions work exactly as before.