Delete an email from a folder only if it is not contained in another folder

by Daniele B   Last Updated November 15, 2017 23:03 PM

I was searching around but found no answers about this issue: I have a folder, in my Gmail account, where I automatically (with filters) put mail with attachments and other characteristics... they are basically emails that could be deleted. I periodically delete all emails form such folder.

However, some of them, which have also additional labels, are useful to me and I don't want to delete.

Is there a way of deleting all emails from a folder except the ones which also belong to other folders?

Another way of considering the question: is there a way to delete all messages marked with a certain label only and not with other labels?

Answers 1

You won't be able to do it with a filter, because those act when the message comes in. However, it's simple to do with a search.

label:first -label:second

That search string will return all conversations with the label first and do not have the label second. The minus sign (- or hyphen, if you prefer) means negation.

More information about search operators is available at Advanced search.

If you want to exclude more labels, simply add them to your search string:

label:first -label:second -label:third
November 22, 2013 13:50 PM

Related Questions

To what extent are filters dependent upon the browser?

Updated December 19, 2016 08:01 AM

How to Permanently Delete Gmail Spam

Updated October 17, 2015 05:01 AM

Calculate the size of label/search/filter?

Updated November 15, 2017 10:03 AM

Gmail placing mails marked as [SPAM] in my inbox

Updated February 27, 2016 01:01 AM