Most useless answer ever?
So modify the script to obtain the latest files within sets of files matching either pattern.
This answer deserves a medal for the most useless answer I've seen in a while... The OP states that he doesn't know how to do that and this whole thread is about "HOW", and you simply tell him that he should *DO* it without explaining *HOW*? Heck, I came here from google hoping to find a *HOW*, not this dumb answer...