def clean_directory(directory):
 if (not os.path.exists(directory)):
  return
 for entry in os.listdir(directory):
  if entry.startswith(u'.'):
   continue
  path = os.path.join(directory, entry)
  if os.path.isdir(path):
   shutil.rmtree(path, True)
  else:
   os.unlink(path)

def clean_directory ( directory ) : if ( not os . path . exists ( directory ) ) : return for entry in os . listdir ( directory ) : if entry . startswith ( u'.' ) : continue path = os . path . join ( directory , entry ) if os . path . isdir ( path ) : shutil . rmtree ( path , True ) else : os . unlink ( path )
remove the content of a directory recursively but not the directory itself .