In Python on a GNU/Linux system, what\'s the fastest way to recursively scan a directory for all .MOV or .AVI files, and to store them in a list? <
.MOV
.AVI
pattern = re.compile('.*\.(mov|MOV|avi|mpg)$') def fileList(source): matches = [] for root, dirnames, filenames in os.walk(source): for filename in filter(lambda name:pattern.match(name),filenames): matches.append(os.path.join(root, filename)) return matches