Thanks. I was aware of has:nouserlabels to find emails with no labels, as I have used it to search in gmail occasionally, but didn't think it would work in a script. Anyway, I threw it in my script along with the others, e.g label:promotions, label:updates and label:forums and it does work in the script to delete emails in the trash folder with no labels. The only difference, and not sure why, the latter 3 take effect instantly re the deletions, the has:nouserlabels works but you don't see the effect until gmail is refreshed. Anyway, thanks for the suggestion.