A repo where I keep/share google apps scripts, that I use for managing general G Suite products.
.gs because it's a google script, but essentially it's just javascript. Run the search string on your inbox first to test out the filter / ensure it doesn't catch anything that you want to keep.
All good? Instantiate an apps script project, test again and then deploy, which would allow you to schedule it to run. ATM the string searches for items older than 30 days, easily changed in the search string to "Xd"