GAM-team / got-your-back

Got Your Back (GYB) is a command line tool for backing up your Gmail messages to your computer using Gmail's API over HTTPS.
https://github.com/GAM-team/got-your-back/wiki
Apache License 2.0
2.6k stars 205 forks source link

[Feature request] Recognize and skip message duplicates #378

Open Suncatcher opened 2 years ago

Suncatcher commented 2 years ago

Please confirm the following:

Having such scenario:

  1. Mailbox A was forwarding the mail to mailbox B for a long time, the forwarded mail was marked with label A
  2. Mailbox B contains messages both A-labeled (30%) and its own messages (70%)
  3. Now I want to migrate mailbox B to A excluding A-labeled messages (i.e. only 70%), only its own

As far as I know, selective backup won't help me with that, it can only include, not exclude labels into backup. I didn't find in the gmail search syntax and expression like not label:A.

I guess GYB does not handle such situations with duplicates: when target mailbox where the backup is restored already contains part of the messages, which are technically duplicated between each other.

Maybe GYB can scan message RFC 5322 headers?

jay0lee commented 2 years ago

Try using:

-label:somelabel

To exclude a certain label.

Suncatcher commented 2 years ago

ok, thanks. Will try

Suncatcher commented 2 years ago

I tried

gyb --email mail@mail.com --action estimate --search "-label:A"

and got

usage: gyb.exe [--email EMAIL]
           [--action {backup,restore,restore-group,restore-mbox,count,purge,purge-labels,print-labels,estimate,quota,reindex,revoke,split-mbox,create-project,delete-projects,check-service-account,create-label}]
           [--search GMAIL_SEARCH] [--local-folder LOCAL_FOLDER] [--label-restored LABEL_RESTORED]
           [--label-prefix LABEL_PREFIX] [--strip-labels] [--vault] [--service-account] [--use-admin USE_ADMIN]
           [--spam-trash] [--batch-size {1 - 100}] [--noresume] [--fast-incremental] [--debug]
           [--memory-limit MEMORY_LIMIT] [--tls-min-version {TLSv1_2,TLSv1_3}]
           [--tls-max-version {TLSv1_2,TLSv1_3}] [--ca-file CA_FILE]
           [--extra-reserved-labels EXTRA_RESERVED_LABELS [EXTRA_RESERVED_LABELS ...]]
           [--extra-system-labels EXTRA_SYSTEM_LABELS [EXTRA_SYSTEM_LABELS ...]] [--config-folder CONFIG_FOLDER]
           [--cleanup] [--cleanup-date CLEANUP_DATE] [--cleanup-from CLEANUP_FROM] [--version] [--short-version]
           [--help]
gyb.exe: error: argument --search: expected one argument

however it works for gyb --email mail@mail.com --action estimate --search "label:A".

So it seems this syntax is not supported