Could you put a comment as to what kind of pattern this is looking for? Is it just looking for filenames that are numbers, e.g. "700034.pgm"?