Closed grigarr closed 2 months ago
@grigarr Sorry for the lack of response on this.
I agree that the functionality offered by imap-backup is hard to understand.
While thinking about, I realised that neither of the existing commands are quite right.
migrate
copies messages, but doesn't avoid duplicates when re-run,mirror
copies messages, avoiding duplicates, but wants to delete any messages it doesn't recognise (via the .mirror file)I've decided to replace both with the copy
command. migrate
and mirror
will be soft deprecated from the next release, and deleted in the future (unless there is a reason to keep one/both).
copy
tracks what it copies and avoids duplicate copies. It ignores whatever else is in the destination folder as it's the user's job to decide whether they want a clean 'mirror' from account to account or some kind of merge where messages arrive from other sources.
I've pushed the branch and will be testing it before merging and releasing.
I really like this change. But I wonder if there would be any command, to only copy the local backup to a remote mailbox? as far as I understood, copy will always do a local backup as first step. could you may add an option to skip the backup step?
@martinpichlo Please have a look at the restore
command to see if it does what you're looking for
@joeyates: In my opinion restore only restores the same account. I'm looking for a command, which restores a local copy into another remote account. so more or less what migrate has done, but with duplicate detection.
would it be enough, if "imap-backup backup" creates the local backup and "imap-backup copy source@domain.tpl destination@domain.tpl" only does the copy from local backup to remote account (without creating an local backup beforehand)? With that szenario we could decouple backup and restore time.
I'm trying to sync emails from an old provider source to a new provider destination. I've run the initial backup of both, then used the migrate function to copy emails to the new destination. I wanted to ensure I had a perfect "sync", with no missing mail from the existing source... so I ran imap-backup migrate again, and it appears to sync every email again rather than only append new/missing mail.
I was skimming the code and see https://github.com/joeyates/imap-backup/blob/8431b42c1d150360e62cf23873d5083b4baacc69/lib/imap/backup/mirror.rb#L73 has an append functionality, would this (mirror) be the correct command to use for ensuring all source emails have been copied to the destination (without deleting any new emails on the destination that may have arrived)? If not, would it be possible to add a sync/append flag to migrate?