Cleaning up dead tickets?

Anyone have a good script for deleting the attached files and then deleting
the tickets from the database for items marked dead??

I was going to write one but I thought I’d see if anyone had one out there
first.