def get_files_recursive(src, fmt):
 for (root, dirnames, filenames) in os.walk(src):
  for filename in fnmatch.filter(filenames, ('*' + fmt)):
   (yield os.path.join(root, filename))

def get_files_recursive ( src , fmt ) : for ( root , dirnames , filenames ) in os . walk ( src ) : for filename in fnmatch . filter ( filenames , ( '*' + fmt ) ) : ( yield os . path . join ( root , filename ) )
src is the source directory .