Welcome Guest.   Make a donation to an author on the site August 29, 2014, 07:20:23 PM  *

Please login or register.
Or did you miss your validation email?


Login with username and password (forgot your password?)
Why not become a lifetime supporting member of the site with a one-time donation of any amount? Your donation entitles you to a ton of additional benefits, including access to exclusive discounts and downloads, the ability to enter monthly free software drawings, and a single non-expiring license key for all of our programs.


You must sign up here before you can post and access some areas of the site. Registration is totally free and confidential.
 
The N.A.N.Y. Challenge 2012! Download dozens of custom programs!
   
   Forum Home   Thread Marks Chat! Downloads Search Login Register  
Pages: [1] 2 Next   Go Down
  Reply  |  New Topic  |  Print  
Author Topic: Script to sort your Gmail messages by size using Google docs  (Read 5707 times)
IainB
Supporting Member
**
Posts: 4,632


Slartibartfarst

see users location on a map View Profile Give some DonationCredits to this forum member
« on: April 19, 2012, 04:14:31 PM »

When my Gmail mailbox got to about 40% storage utilisation, I set about clearing out the large emails. I deleted those I didn't want to keep, but those I did had their bulky contents archived.
My search-and-archive process was:
  • identify those emails with documents attached or containing embedded images;
  • save the attachments/images to disk or Gdocs;
  • forward the containing emails - but now containing nothing - to myself, adding links or references to where embedded/attached items had been stored.
  • delete the original email and its contained/attached items.
Over time, using this method, I reduced my Gmail storage utilisation to 20%, and without losing/deleting any emails that I wanted to keep.

The process I used is an ironically manually intensive approach to cleaning out a sophisticated hi-tech computer data storage and retrieval system. It pained me to do it, as I really could have used something that automated aspects of the search-and-archive process to make it more efficient.
Today I came across this script. It seems to work, and I am running it now:
Sort your Gmail Messages by Size using Google Docs
Logged
eleman
Supporting Member
**
Posts: 268

see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #1 on: April 19, 2012, 06:32:21 PM »

weehaa... muchos fantasticos

Thanks a ton, wifey managed to fill her gmail account. This will make clean-up much easier.
Logged
tomos
Charter Member
***
Posts: 8,475



see users location on a map View Profile WWW Give some DonationCredits to this forum member
« Reply #2 on: April 19, 2012, 06:33:20 PM »

Thanks, I'm up at 5.5GB mainly due to lots of large Tiff attachments.

How long did it take? Slow here...
It stopped a couple of times but seems to be running okay now.

It's a bummer that you cant just remove attachments in gmail...
Logged

Tom
rgdot
Supporting Member
**
Posts: 1,590


View Profile WWW Give some DonationCredits to this forum member
« Reply #3 on: April 19, 2012, 07:29:16 PM »

One of the most useful tools in a while  Thmbsup
Logged
IainB
Supporting Member
**
Posts: 4,632


Slartibartfarst

see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #4 on: April 19, 2012, 08:17:57 PM »

weehaa... muchos fantasticos
Yes, that's sort of what I said too.  
I am still running the script. It's doing quite a lot of work! - covering thousands of emails. It keeps getting timed-out by Google with the warning message:
Quote
Oops
Exceeded maximum execution time
When that happens I just restart it ("Scan mailbox" from the script's new Gmail dropdown menu) and it seems to continue from where it last left off in the spreadsheet.  
But when it's done, the spreadsheet should be a very useful tool for taking stock of your bloated emails.
You should then be able to deal with the top 20% of your biggest emails first, and apply the Pareto principle to removing 80% of your remaining Gmail bloat.

We shall see.
EDIT: I've just edited the thing per where the labnol post says Scan Gmail Messages with a trigger, so that the scan runs every 10 minutes instead of my having to manually start/restart he scan.
Smart thinking Batman.    embarassed
« Last Edit: April 20, 2012, 01:06:09 AM by IainB; Reason: Modify per 10-minute interval scan-triggering. » Logged
IainB
Supporting Member
**
Posts: 4,632


Slartibartfarst

see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #5 on: April 20, 2012, 05:36:24 PM »

Conclusion:
  • I left the script running all day and night yesterday, and then switched off the 10-minute trigger interval. (Note to self: Remember to switch such triggers off at some stage!)
  • The spreadsheet listed about 470Mb in total, saved in 135 sizeable emails ranging in size from 21Mb to 1.01Mb.
  • Just by deleting the 21Mb file (a Photoshopped image someone had sent me ages ago that I had forgotten about - oops!) and three 8Mb-sized files (containing attached images), my percentage storage utilisation fell from 20% to 19%.
  • I am now embarked on a progressive archive and deletion of the contents of the remainder of the population of 135 emails (i.e., not expunging the emails themselves, just the fat contents/attachments).
« Last Edit: April 20, 2012, 05:44:02 PM by IainB » Logged
IainB
Supporting Member
**
Posts: 4,632


Slartibartfarst

see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #6 on: April 25, 2012, 11:25:16 AM »

Further results. My Gmail is now down to 14% full.
Logged
eleman
Supporting Member
**
Posts: 268

see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #7 on: April 25, 2012, 11:27:31 AM »

BTW, google seems to increase gmail quotas from 7.5 to 10 GB, simultaneously with the google drive launch.
Logged
anandcoral
Honorary Member
**
Posts: 221



see users location on a map View Profile WWW Give some DonationCredits to this forum member
« Reply #8 on: April 25, 2012, 11:52:15 AM »

I have been using Outlook Express in MAPI mode to clean up my GMail accounts from the early time when it had 2 GB quota, and still use it.

I download just the header of all mails from GMAil. It comes pretty fast in MAPI mode even from a 90% full GMail account, in less than 2/3 minutes. I can download headers of just Inbox or All_Mail or any other labeled mails. No timeout or so message, as just the header gets downloaded, which shows the from, subject, date and most important size of each mail.

I flag (which shows as starred in GMail) all those which are bigger or just drag them to GMail/Trash folder in OE which is similar to deleting mails in GMail. Please note that deleting mail by pressing delete key in OE will not work, you need to move/drag them to GMail/Trash folder.

Some of my GMail account which I use for all types of subscription, gets filled up too soon, as I do not check them regularly. So when ever GMail informs me about the quota full, I use OE to clean up.

Another reason of using OE instead of any other 3rd party app or web service is that the password is not given to any other app/service, even I do not save it.

Give it a try and you may be surprised by the speed and simplicity of it. You may use Outlook instead of OE and it should give same result, but I have never tried it.

Regards,

Anand
Logged
tomos
Charter Member
***
Posts: 8,475



see users location on a map View Profile WWW Give some DonationCredits to this forum member
« Reply #9 on: April 25, 2012, 12:01:32 PM »

I decided it was to time consuming for me, and I needed to do a back up of everything anyway, so I decided to use Mail Store to download all mail and then delete the older mail. Unfortunately mailstore gave a bunch of error messages which I haven't had time to look at yet so I'm stalled.

Saved by the bell smiley
BTW, google seems to increase gmail quotas from 7.5 to 10 GB, simultaneously with the google drive launch.
Logged

Tom
TaoPhoenix
Supporting Member
**
Posts: 3,478



0 - 60 ... then back to 0 again!

see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #10 on: April 25, 2012, 08:03:28 PM »

Hehe I am at 24Gigs of a 25 Gig quota!

It seems to be running now. Here goes!

Edit: It only found about 10 emails the first run before it timed out! What use is that?  I can do manual heuristics faster than that!

« Last Edit: April 25, 2012, 08:17:24 PM by TaoPhoenix » Logged
IainB
Supporting Member
**
Posts: 4,632


Slartibartfarst

see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #11 on: April 26, 2012, 09:52:52 AM »

It only found about 10 emails the first run before it timed out! What use is that?  I can do manual heuristics faster than that!
Set the script to auto-trigger at 5 or 10 minute intervals (per thread above) and check the Gdocs spreadsheet the next day - that's what I did. You don't even have to have the spreadsheet open that way. All automated.    Thmbsup
Logged
IainB
Supporting Member
**
Posts: 4,632


Slartibartfarst

see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #12 on: April 26, 2012, 09:56:54 AM »

BTW, google seems to increase gmail quotas from 7.5 to 10 GB, simultaneously with the google drive launch.
Oops! That's why my utilisation was down to 14%!! The cap just grew a bit bigger, that's all.
I thought I hadn't deleted enough to knock it down to 14% yet!    embarassed
I hadn't noticed the 2nd part of the message where it says:
Quote
14% full
Using 1497 MB of your 10240 MB

Logged
tomos
Charter Member
***
Posts: 8,475



see users location on a map View Profile WWW Give some DonationCredits to this forum member
« Reply #13 on: April 26, 2012, 04:48:43 PM »

Oops! That's why my utilisation was down to 14%!! The cap just grew a bit bigger, that's all.
I thought I hadn't deleted enough to knock it down to 14% yet!    embarassed
I hadn't noticed the 2nd part of the message where it says:

either way, we win smiley
Logged

Tom
TaoPhoenix
Supporting Member
**
Posts: 3,478



0 - 60 ... then back to 0 again!

see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #14 on: May 04, 2012, 11:45:25 AM »


I've been trying out this script. It gets to about 235 entries on the spreadsheet and then it stopped finding anything else.
Logged
tomos
Charter Member
***
Posts: 8,475



see users location on a map View Profile WWW Give some DonationCredits to this forum member
« Reply #15 on: May 04, 2012, 03:33:20 PM »

I've been trying out this script. It gets to about 235 entries on the spreadsheet and then it stopped finding anything else.

is it that it keeps stopping?
- you have to restart it. Iain says above somewhere how he worked around it, but I didnt get that far myself...


EDIT/ mind you if you deleted 235 entries with an average of 10MB (??) you'd have a nice bit of space.
Logged

Tom
TaoPhoenix
Supporting Member
**
Posts: 3,478



0 - 60 ... then back to 0 again!

see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #16 on: May 04, 2012, 04:37:18 PM »

At one point it quit finding new messages at all. And 90% of the ones it did had only 1.3 megs. And "No, 235 * 1.3 megs is still piddly."

I send scanned contracts all the time, they're always 10 megs, doesn't mean I want to delete that email.

Heh my work email box is 25 gigs at 96% full.  : )
Logged
tomos
Charter Member
***
Posts: 8,475



see users location on a map View Profile WWW Give some DonationCredits to this forum member
« Reply #17 on: May 04, 2012, 05:44:09 PM »

At one point it quit finding new messages at all. And 90% of the ones it did had only 1.3 megs. And "No, 235 * 1.3 megs is still piddly."

I send scanned contracts all the time, they're always 10 megs, doesn't mean I want to delete that email.

Heh my work email box is 25 gigs at 96% full.  : )

If you download all to an email client, and make a backup, couldnt you then start deleting the oldest mails?
(mind you that was my idea using mailstore but I think I have to make a second attempt there)
Logged

Tom
IainB
Supporting Member
**
Posts: 4,632


Slartibartfarst

see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #18 on: May 04, 2012, 06:09:54 PM »

I've been trying out this script. It gets to about 235 entries on the spreadsheet and then it stopped finding anything else.
is it that it keeps stopping?
- you have to restart it. Iain says above somewhere how he worked around it, but I didnt get that far myself...

Set the script to auto-trigger at 5 or 10 minute intervals (per thread above) and check the Gdocs spreadsheet the next day - that's what I did. You don't even have to have the spreadsheet open that way. All automated.    Thmbsup

To automate the script trigger:
  • 1. Go to the article: Sort your Gmail Messages by Size using Google Docs
  • 2. Go to the part with the subtitle: Scan Gmail Messages with a trigger
  • 3. To enable the trigger, follow the steps detailed there. (You can't "break" anything, so treat it as an experiment.)
  • 4. Leave the script running for a while (say) overnight. You don't have to be online for it to run.
  • 5. Check it to see your updated list of large emails.
  • 6. Disable the trigger, otherwise it will keep triggering the script forever.
« Last Edit: May 04, 2012, 07:31:26 PM by IainB; Reason: Minor correction. » Logged
TaoPhoenix
Supporting Member
**
Posts: 3,478



0 - 60 ... then back to 0 again!

see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #19 on: May 04, 2012, 06:10:33 PM »

I can delete them as is, I'd miss the searchability. I wish there was an app for "download all the attachments, print the email text itself to a PDF, throw all that into a folder".
Logged
TaoPhoenix
Supporting Member
**
Posts: 3,478



0 - 60 ... then back to 0 again!

see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #20 on: May 04, 2012, 06:11:33 PM »

Iain you're smarter than this ol' sharp marble, so I dunno if I'll actually get around to doing that : )
Logged
IainB
Supporting Member
**
Posts: 4,632


Slartibartfarst

see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #21 on: May 04, 2012, 06:17:51 PM »

I can delete them as is, I'd miss the searchability. I wish there was an app for "download all the attachments, print the email text itself to a PDF, throw all that into a folder".
What I do:
I view each email shown in the spreadsheet, starting with the biggest.
If I want to keep the attachment:
(a) I save it to Gdocs (now Gdrive) and give it a useful/relevant filename;
(b) I get the link to that file as a Shared file.
(c) I select foward for the email, insert the filename and link in the text at at the top of the email, and untick the attachment box.
(d) Put my address as the "To" name for the email (I'm sending it to myself).
(e) send the email, now less any attachment.
(f) Delete the email with the attachment.

That way, you get to separate the email from the attachment, save them both, and keep them linked.

It's a bit tedious, so I do this in bits, over time. It's surprising what a dent you can make in your "fat" emails this way, and it makes for more orderly storage.
If you use the Gdrive app to sync to your PC (I recommend this), then you can have all the attached files (which are now detached and saved in Gdrive) backed up on your PC. If you want to do that, then select their Gdrive folders in the Gdrive sync app. (I sync all folders - the whole Gdrive - by default.)
The first time the sync runs, it takes a while (all files/folders selected get transferred to your PC), but after that it's not too busy.

Your email will thus eventually be just email with no/few attachments, and you can similarly back the email up using a client email package (e.g., Outlook) on your PC.
____________________________________________
WARNING:
  • Gdrive has virtual "folders" (they are really like Gmail labels  - "tags"), and you can place a file in several of these "folders". It's a great way to organise your files into categories. But there's always only one single copy of the file, no matter how many folders you have it in (unless you deliberately create a duplicate of it).
  • So, if you shuffle your files around in the folders on Gdrive or tick a file as being in more than one folder, then that will cause the sync app to save a duplicate of the file to each logical folder on your PC. All those duplicates could have the potential to become very confusing (e.g., which is the version you want to update offline?), a waste of disk space, and a bandwidth hog if you shuffle files around a lot whilst organising things.
  • So consider turning the sync app off until your shuffling has finished and experiment carefully to discover how offline update affects file updates to Gdrive after online sync.
« Last Edit: May 04, 2012, 07:39:43 PM by IainB; Reason: Amended text and added WARNING notes. » Logged
TaoPhoenix
Supporting Member
**
Posts: 3,478



0 - 60 ... then back to 0 again!

see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #22 on: May 04, 2012, 06:54:56 PM »

You're awesome, but we'll see.

Heh I have 87,000 messages in my *sent* box. Sky knows how many total! : )
Logged
IainB
Supporting Member
**
Posts: 4,632


Slartibartfarst

see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #23 on: May 04, 2012, 07:24:57 PM »

Heh I have 87,000 messages in my *sent* box. Sky knows how many total! : )
That's a lot.    ohmy
In my case, as soon as Gdocs enabled the file link capability in Gdocs some years back, I started using it to reduce my Inbox bloat - as detailed in my above post.
Every file that has an attachment that I receive gets this same archival treatment.
I press "forward", insert my email address, untick the attachment box and have an AHK script that types into the top of the email:
Quote
   For archives:
   File(s):
- and I just add the filename and link in Gdrive.
Then I press send, and delete the original email.
Fortunately I don't get too many such emails.
I would automate it further if I could. (Any ideas?)

As for sending, I rarely send an actual file attachment, just an email with a link to the file saved in Gdocs.
I think - but am not sure - that Gdrive could help to make this easier to do. Still experimenting with it though.

By the way, I have edited my previous post above and added a WARNING regarding the difference between Gdrive virtual "folders" and the logical folders that Gdrive sync turns those folders into on your PC. Potential duplication/confusion. (I'm sure I'm not the only person to have mentioned this to Google in their feedback form.)
Logged
TaoPhoenix
Supporting Member
**
Posts: 3,478



0 - 60 ... then back to 0 again!

see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #24 on: May 04, 2012, 07:26:32 PM »

I think I have over 160,000 in my total box. I inherited a colleague's email box as part of the total. Wheeee!   Grin cheesy

Edit: (Iain says:) " Fortunately I don't get too many such emails."

Heh 40% of my emails have attachments! : )
"If it doesn't have an attachment one of you two isn't working hard enough" - Me just now   tongue
Logged
Pages: [1] 2 Next   Go Up
  Reply  |  New Topic  |  Print  
 
Jump to:  
   Forum Home   Thread Marks Chat! Downloads Search Login Register  

DonationCoder.com | About Us
DonationCoder.com Forum | Powered by SMF
[ Page time: 0.048s | Server load: 0.06 ]