def remove_samples(path):
 RE_SAMPLE = re.compile(sample_match, re.I)
 for (root, _dirs, files) in os.walk(path):
  for file_ in files:
   if RE_SAMPLE.search(file_):
    path = os.path.join(root, file_)
    try:
     logging.info('Removing unwanted sample file %s', path)
     os.remove(path)
    except:
     logging.error(T('Removing %s failed'), clip_path(path))
     logging.info('Traceback: ', exc_info=True)

def remove_samples ( path ) : RE_SAMPLE = re . compile ( sample_match , re . I ) for ( root , _dirs , files ) in os . walk ( path ) : for file_ in files : if RE_SAMPLE . search ( file_ ) : path = os . path . join ( root , file_ ) try : logging . info ( 'Removing unwanted sample file %s' , path ) os . remove ( path ) except : logging . error ( T ( 'Removing %s failed' ) , clip_path ( path ) ) logging . info ( 'Traceback: ' , exc_info = True )
remove all files that match the sample pattern .