rendered paste bodyhome_pattern = re.compile(r'home.*\.xml')application_directory = re.compile('files_.*')root = whateverpathdef is_home_file(f): return home_pattern.match(f)def isApplicationDirectory(f): fullpath = os.path.join(self.portal_root,f) return os.path.isdir(fullpath) and application_directory.match(f)home_paths = filter(isApplicationDirectory,os.listdir(root)) home_files = [] for home_path in home_paths: def fullpath(f): return os.path.join(root,home_path,f) home_files.append(map(fullpath,filter(is_home_file,os.listdir(fullpath(u'.')))))def Crawler(hfs): for hf in hfs: open(hf,'r') Crawler(home_files)