def _GetFilesRecursively(path, excl_regexps=['#.*', '\\..+', '.*~$', '.*\\.pyc$', '.*_test.py$', '.*_pkg.py$']):
 entries = os.listdir(path)
 dirs = [e for e in entries if (os.path.isdir(os.path.join(path, e)) and _FileMatches(e, excl_regexps))]
 files = [os.path.join(path, e) for e in entries if (os.path.isfile(os.path.join(path, e)) and _FileMatches(e, excl_regexps))]
 for d in dirs:
  files += _GetFilesRecursively(os.path.join(path, d), excl_regexps)
 return files

def _GetFilesRecursively ( path , excl_regexps = [ '#.*' , '\\..+' , '.*~$' , '.*\\.pyc$' , '.*_test.py$' , '.*_pkg.py$' ] ) : entries = os . listdir ( path ) dirs = [ e for e in entries if ( os . path . isdir ( os . path . join ( path , e ) ) and _FileMatches ( e , excl_regexps ) ) ] files = [ os . path . join ( path , e ) for e in entries if ( os . path . isfile ( os . path . join ( path , e ) ) and _FileMatches ( e , excl_regexps ) ) ] for d in dirs : files += _GetFilesRecursively ( os . path . join ( path , d ) , excl_regexps ) return files
recursively walks the source directory and locates matching files .