need to advice: about gmail trash empty

Hellow^^^

my mailbox is Google Apps (Gmail). it is now full (almost 98%). most
messages are trash folder. just i did try to remove all trash messages
permantly on the web. but web browser was freeze. so i thank a
while. yes i have to ruby script!!! i like ruby but just i am newbie
level. so please advise any comments about empty trash gmail with
ruby. currently i use ruby 2.5 on ubuntu 18.04, hardware is chromebook [arm64].

any comments welcome!!! thanks in advance,

Sincerely,

Byung-Hee from South Korea

···

--
^고맙습니다 _地平天成_ 감사합니다_^))//

soyeomul@doraji.xyz (Byung-Hee HWANG "(황병희, 黃炳熙)") writes:

[...snip...]
my mailbox is Google Apps (Gmail). it is now full (almost 98%). most
messages are trash folder. just i did try to remove all trash messages
permantly on the web. but web browser was freeze. so i thank a
while. yes i have to ruby script!!! i like ruby but just i am newbie
level. so please advise any comments about empty trash gmail with
ruby. currently i use ruby 2.5 on ubuntu 18.04, hardware is chromebook [arm64].

just i installed ruby gem 'gmail' by `sudo gem install gmail'. install is
success. then i wrote as code:

#+BEGIN_SRC ruby
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-

require 'gmail'

gmail = Gmail.connect('MY_GMAIL_ID', 'MY_GMAIL_PASSWORD')

gmail.mailbox('[Gmail]/Trash').emails.each do |email|
  email.delete!
end

gmail.connection.expunge
gmail.logout
#+END_SRC

but i did failed. see as belows: (error messages)

#+BEGIN_SRC txt
(bionic)soyeomul@localhost:~/work$ ./1.rb
Traceback (most recent call last):
  11: from ./1.rb:10:in `<main>'
  10: from /var/lib/gems/2.5.0/gems/gmail-0.7.1/lib/gmail/client/base.rb:159:in `mailbox'
   9: from /var/lib/gems/2.5.0/gems/gmail-0.7.1/lib/gmail/client/base.rb:159:in `synchronize'
   8: from /var/lib/gems/2.5.0/gems/gmail-0.7.1/lib/gmail/client/base.rb:162:in `block in mailbox'
   7: from /var/lib/gems/2.5.0/gems/gmail-0.7.1/lib/gmail/client/base.rb:222:in `switch_to_mailbox'
   6: from /usr/lib/ruby/2.5.0/net/imap.rb:457:in `select'
   5: from /usr/lib/ruby/2.5.0/monitor.rb:226:in `mon_synchronize'
   4: from /usr/lib/ruby/2.5.0/net/imap.rb:459:in `block in select'
   3: from /usr/lib/ruby/2.5.0/net/imap.rb:1253:in `send_command'
   2: from /usr/lib/ruby/2.5.0/monitor.rb:226:in `mon_synchronize'
   1: from /usr/lib/ruby/2.5.0/net/imap.rb:1271:in `block in send_command'
/usr/lib/ruby/2.5.0/net/imap.rb:1217:in `get_tagged_response': Unknown Mailbox: [Gmail]/Trash (Failure) (Net::IMAP::NoResponseError)
(bionic)soyeomul@localhost:~/work$
#+END_SRC

thanks in advance,

···

--
^고맙습니다 _地平天成_ 감사합니다_^))//

/usr/lib/ruby/2.5.0/net/imap.rb:1217:in `get_tagged_response': Unknown Mailbox: [Gmail]/Trash (Failure) (Net::IMAP::NoResponseError)

just i did change language of Gmail: Korean -> English.
so now the script is working, there are 167700 messages, in Trash.

thanks^^^

···

--
^고맙습니다 _地平天成_ 감사합니다_^))//