def remove_all(path, pattern='*', keep_folder=False, recursive=False):
 if os.path.exists(path):
  files = globber_full(path, pattern)
  if ((pattern == '*') and (not sabnzbd.WIN32)):
   files.extend(globber_full(path, '.*'))
  for f in files:
   if os.path.isfile(f):
    try:
     os.remove(f)
    except:
     logging.info('Cannot remove file %s', f)
   elif recursive:
    remove_all(f, pattern, False, True)
  if (not keep_folder):
   try:
    os.rmdir(path)
   except:
    logging.info('Cannot remove folder %s', path)

def remove_all ( path , pattern = '*' , keep_folder = False , recursive = False ) : if os . path . exists ( path ) : files = globber_full ( path , pattern ) if ( ( pattern == '*' ) and ( not sabnzbd . WIN32 ) ) : files . extend ( globber_full ( path , '.*' ) ) for f in files : if os . path . isfile ( f ) : try : os . remove ( f ) except : logging . info ( 'Cannot remove file %s' , f ) elif recursive : remove_all ( f , pattern , False , True ) if ( not keep_folder ) : try : os . rmdir ( path ) except : logging . info ( 'Cannot remove folder %s' , path )
remove all files in a transaction .