I have about 18000 email in my gmail inbox.  I've created labels: 2009, 2010, 2011 and I'd like to search for all 2009 emails and label them all at once for 2009, then do the same thing for 2010 and 2011.  Problem is when I use the before: 2010/12/31 (for example) it brings up 20 at a time, which I have to select all, then label with the apropriate lable and repeat this way too many times!
I'd like to know if there is a way I can basically search for all email in 2010 and label them all 2010 to reduce the number of emails I see in my inbox.
Seems like I remember someone saying sql language could be used in the search field to do some things like this.

asked 11/29/2011 11:53

BRIDGEDIVISION's gravatar image


7 Answers:
You could create a filter and put your before/after date range in the "Has the words" part of the filter creation, then configure the filter to apply a specific label.

Try and it out and let me know if that works for what you want.


Papertrip's gravatar image


Sorry, Gmail doesn't do anything with SQL in its search field (I wish it did!)

When you do your search and then click on the select all checkbox (to the left of the "Archive" button), a bar should appear between the buttons and your mail results with:

   All 20 conversations on this page are selected. Select all conversations that match this search

Click on the "Select all ..." link and then apply your label choice.

I tried it just now with my Gmail account and the search:

   before:2010/1/1 after:2008/12/31

And was able to label almost 8000 messages in only a few seconds.

answered 2011-11-30 at 09:52:56

nemws1's gravatar image


nemws1, what you're describing is exactly what I need; however, after following your instructions, the various year labels I set up did populate (ie: 2009, 2010, 2011), but all of my email still shows up in the inbox.  I want the email from the inbox in the labeled folders so my inbox is cleaner :)

answered 2011-11-30 at 09:56:26

BRIDGEDIVISION's gravatar image


Just go to each of your label folders (ie click on '2009' in the left-hand pane) and then do the same selection as before (select all box, then click on 'Select all..' link) and then click on the "Archive" button - this will remove the "Inbox" label, but leave everything still in your various year folders.

answered 2011-11-30 at 10:29:09

nemws1's gravatar image


nemws1, hope I'm not that dense, but I swear I don't see the archive button when I click on the 2009 label, select all... no archive button that I can see.
There is a delete, move to, report spam, & more button.

answered 2011-11-30 at 10:35:37

BRIDGEDIVISION's gravatar image


Weird... I'm not sure what I've set to see the archive button - I checked my Google Labs setting and didn't see anything.  Here's my button row after doing a search:
  • 16 KB
  • Gmail buttons after doing a search
Gmail buttons after doing a search

You could turn on keyboard shortcuts in settings and then try hitting the 'e' key when you have everything selected in your search results ('e' is the shortcut for Archive).

    answered 2011-11-30 at 11:02:01

    nemws1's gravatar image


    Great answer and helpful info during the solution.

    answered 2011-11-30 at 12:57:42

    BRIDGEDIVISION's gravatar image


    Your answer
    [hide preview]

    Follow this question

    By Email:

    Once you sign in you will be able to subscribe for any updates here

    By RSS:


    Answers and Comments



    Asked: 11/29/2011 11:53

    Seen: 294 times

    Last updated: 11/30/2011 06:40