Faster implementation of file-matching.