def get_file_list(directory, exclude_patterns=None):
 result = []
 if (not directory.endswith('/')):
  directory = (directory + '/')
 def include_file(file_path):
  if (not exclude_patterns):
   return True
  for exclude_pattern in exclude_patterns:
   if fnmatch.fnmatch(file_path, exclude_pattern):
    return False
  return True
 for (dirpath, dirnames, filenames) in os.walk(directory):
  base_path = dirpath.replace(directory, '')
  for filename in filenames:
   if base_path:
    file_path = os.path.join(base_path, filename)
   else:
    file_path = filename
   if include_file(file_path=file_path):
    result.append(file_path)
 return result

def get_file_list ( directory , exclude_patterns = None ) : result = [ ] if ( not directory . endswith ( '/' ) ) : directory = ( directory + '/' ) def include_file ( file_path ) : if ( not exclude_patterns ) : return True for exclude_pattern in exclude_patterns : if fnmatch . fnmatch ( file_path , exclude_pattern ) : return False return True for ( dirpath , dirnames , filenames ) in os . walk ( directory ) : base_path = dirpath . replace ( directory , '' ) for filename in filenames : if base_path : file_path = os . path . join ( base_path , filename ) else : file_path = filename if include_file ( file_path = file_path ) : result . append ( file_path ) return result
recurisvely retrieve a list of files in the provided directory .