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

gmailgmail-filtersgmail-labels

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?

Best Answer

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