def recursive_rm(*patterns):
 for (root, subdirs, subfiles) in os.walk('.'):
  root = os.path.normpath(root)
  if root.startswith('.git/'):
   continue
  for file in subfiles:
   for pattern in patterns:
    if fnmatch.fnmatch(file, pattern):
     safe_remove(os.path.join(root, file))
  for dir in subdirs:
   for pattern in patterns:
    if fnmatch.fnmatch(dir, pattern):
     safe_rmtree(os.path.join(root, dir))

def recursive_rm ( * patterns ) : for ( root , subdirs , subfiles ) in os . walk ( '.' ) : root = os . path . normpath ( root ) if root . startswith ( '.git/' ) : continue for file in subfiles : for pattern in patterns : if fnmatch . fnmatch ( file , pattern ) : safe_remove ( os . path . join ( root , file ) ) for dir in subdirs : for pattern in patterns : if fnmatch . fnmatch ( dir , pattern ) : safe_rmtree ( os . path . join ( root , dir ) )
recursively remove a file or matching a list of patterns .