Many thanks Kirby, this is just what I was looking for

I just have a few questions.
1) If I add a new forum later do I have to rerun the query?
2) Will this ignore sticky topics? If I have something as a sticky I'd like it to be exempt from any/all pruning functions including this auto-prune.
I have this installed and I've setup a few "tests" to confirm that it is working. I ran the task manually and it appears to work, I'll know more tomorrow after the scheduled task runs