News for hackers. Stuff that matters.
Re:Show HN: Gmail CLI Utils (bulk delete mail by query, get/... by notyourday on Sunday April 26, 2020 @08:41PM (#22991782)
I know this is an odd question but...

Have you tried deleting a very large number of messages? I am talking about > 100,000. I once needed to clean up > million messages and it was rather challenging even utilizing Google's scripting. Batching ( within Google's recommended parameters ) would periodically fail. Triggers would not run. etc.

Re:Show HN: Gmail CLI Utils (bulk delete mail by query, get/... by pfranz on Monday April 27, 2020 @01:03AM (#22993027)
I've had the same issue spanning years. I didn't bother going further than the web UI. I would delete 100k+ messages, it would hang, and when it returned it would only have deleted like 70k.
Re:Show HN: Gmail CLI Utils (bulk delete mail by query, get/... by emmelaich on Monday April 27, 2020 @01:11AM (#22993059)
This hack might work.

1. Move all the messages to a folder.

2. Then delete that folder.

Re:Show HN: Gmail CLI Utils (bulk delete mail by query, get/... by bishalb on Sunday April 26, 2020 @11:17PM (#22992573)
You can just Create a filter to delete such messages and check apply to all existing conversations.
Re:Show HN: Gmail CLI Utils (bulk delete mail by query, get/... by stevekemp on Monday April 27, 2020 @03:20AM (#22993658)
Having gone through this recently you'll see a spinner/progress indicator. Then a short time later it'll terminate and half your messages will still be present.

I took several days deleting a few hundred thousand messages, "Select all", "delete". Each time it would remove 1000-10,000 messages and leave the rest. Was a real pain.

Re:Show HN: Gmail CLI Utils (bulk delete mail by query, get/... by notyourday on Monday April 27, 2020 @07:01AM (#22994706)
After a lot of trial and error I have been successful at doing a limit fetch and limit delete with a limit of 9000 in 5 minute intervals using scripting API with a registering a timed trigger.

1. Get current time, increase the time by 5 minutes and find the 5 minute mark after that.

2. Register itself to run the time determined in (1).

3. Fetch a batch of 9000 ids matching the filter.

4. Delete the batch

This script would comfortably run for days cleaning out the inbox until it would hit some weird message that looked nearly identical to the messages around it and bomb(!?). Running it by hand would bomb at which point script won't be able to continue to execute. Deleting a message by hand would work. Running the script again after the manual deletion would work.

Re:Show HN: Gmail CLI Utils (bulk delete mail by query, get/... by notyourday on Monday April 27, 2020 @06:52AM (#22994676)
My first thought after "how hard can it be? Since all the messages are from the monitoring systems I can just assign the labels based on the 'from' address and..." was to use that exact approach. It have never seen that many timeouts in my life.
Re:Show HN: Gmail CLI Utils (bulk delete mail by query, get/... by abionic on Monday April 27, 2020 @01:09AM (#22993052)
yes I did

although I tried deleting for one or two years at a time