in reply to Glob best match?

You can just sort the globs, and try the most specific first, and execute only the action assoicated with the first match.

You can define a score like this: eliminate all meta characters from the glob (so fred/*.mac becomes fred/.mac), and use the number of characters in that resulting string as a (crude) measure for specificity.

If you don't want to assign scores, but just compare pairs of globs for which one is more specific, a topologic sort can help you to get them in order for comparison.