imapsync icon indicating copy to clipboard operation
imapsync copied to clipboard

Compare and delete duplicates only (no sync)?

Open supertin opened this issue 11 months ago • 3 comments

Hi everyone. I've been using imapsync to move a few accounts off an aging server to a more modern one. Works fantastic, BTW.

My question is this... One user had their GMail account syncing into the old server via IMAP. We don't want to sync this folder to the new server, but I also don't want to just delete it without verifying the messages are either still on the GMail server or are meant to be deleted. My plan was/is to run a search for messages that exist on both servers, and delete the copy on the local old server... But I don't want to actually sync anything.

Is this possible with imapsync? I see the --dry option, but I'm assuming this also prevents the delete duplicates option from running too... Am I correct in thinking that?

supertin avatar Jan 20 '25 02:01 supertin

One user had their GMail account syncing into the old server via IMAP. We don't want to sync this folder to the new server, but I also don't want to just delete it without verifying the messages are either still on the GMail server or are meant to be deleted.

I don't understand the picture. There is a Gmail account, synced into an old server via IMAP, then a new server. Well, I'm confused. I see three accounts in this description.

My plan was/is to run a search for messages that exist on both servers, and delete the copy on the local old server... But I don't want to actually sync anything.

Now, only two. Am I right?

Is this possible with imapsync? I see the --dry option, but I'm assuming this also prevents the delete duplicates option from running too... Am I correct in thinking that?

I don't get well your need so far but it looks like --delete1 partially does what you want. But it is a sync. https://imapsync.lamiral.info/README

...
    A different scenario is to delete the messages from the source mailbox
    after a successful transfer, it can be a good feature when migrating
    mailboxes since messages will be only on one side. The source account
    will only have messages that are not on the destination yet, i.e.,
    messages that arrived after a sync or that failed to be transferred.

    In that case, use the --delete1 option. Option --delete1 implies also
    the option --expunge1 so all messages marked deleted on host1 will be
    deleted. In IMAP protocol deleting a message does not delete it, it
    marks it with the flag \Deleted, allowing an undelete. Expunging a
    folder removes, definitively, all the messages marked as \Deleted in
    this folder.

    You can also decide to remove empty folders once all of their messages
    have been transferred. Add --delete1emptyfolders to obtain this
    behavior.
...
 OPTIONS/deletions

     --delete1           : Deletes messages on host1 server after a successful
                           transfer. Option --delete1 has the following behavior:
                           it marks messages with the IMAP flag
                           \Deleted, then messages are deleted with an
                           EXPUNGE IMAP command. If expunging after each message
                           slows down too much the sync then use
                           --noexpungeaftereach to speed up, expunging will then be
                           done only twice per folder, one at the beginning and
                           one at the end of a folder sync.

gilleslamiral avatar Jan 21 '25 15:01 gilleslamiral

Lol. Yes, I didn't describe it very well. The user had added Gmail syncing under a folder in the old server. We've copied out all the local data and left that single folder on the old server of Gmail content. So there are only 2 servers now involved - the old server and Gmail.

I guess I could sync the old server over to Gmail and just tell him some of the spam and other stuff he's deleted recently might come back if it was on the old server already but deleted after we disconnected the syncing... That would probably get the job done. I kind of wanted to avoid putting back any mass mailed junk he might have deleted but I guess there probably would only be a few.

supertin avatar Jan 21 '25 23:01 supertin

Lol. Yes, I didn't describe it very well. The user had added Gmail syncing under a folder in the old server. We've copied out all the local data and left that single folder on the old server of Gmail content. So there are only 2 servers now involved - the old server and Gmail.

This is still very confusing. "Gmail syncing under a folder", what is it? local data? what is it? "old server of Gmail content". So Gmail is out. Well, maybe. it was "Gmail syncing under a folder". Then only two servers left including Gmail, Gmail again?

I guess I could sync the old server over to Gmail and just tell him some of the spam and other stuff he's deleted recently might come back if it was on the old server already but deleted after we disconnected the syncing... That would probably get the job done. I kind of wanted to avoid putting back any mass mailed junk he might have deleted but I guess there probably would only be a few.

Ask him.

gilleslamiral avatar Jan 22 '25 13:01 gilleslamiral