Sorry for stepping on your script. I had thought about waiting a few days, but I was ready to post it. Here's Braxton's script for those who might want to use it instead:
http://www.conitecserver.com/ubbthreads/showflat.php?Cat=&Number=486436
It's somewhat similar, but not quite as flexible. Still, if that's all you need and script execution time is a factor......