#!/usr/bin/env python#coding=utf8'''Python ver 2.7Search some file recursivily'''import osimport fnmatchdef recursiveSearchFile(searchPath, partInfo): wantFilesPath = [] for (dirPath, dirNames, fileNames) in os.walk(searchPath): wantFilesPath += [os.path.join(dirPath, fileName) for fileName in fileNames if fnmatch.fnmatch(os.path.join(dirPath, fileName), partInfo)] return wantFilesPathif __name__ == "__main__": fileList = recursiveSearchFile('C:\\Users\Administrator\\Desktop', '*.pl') for path in fileList: print path