def recursive_unlink(f):
 if os.path.isdir(f):
  for s in os.listdir(f):
   recursive_unlink(os.path.join(f, s))
  os.rmdir(f)
 elif os.path.isfile(f):
  os.unlink(f)

def recursive_unlink ( f ) : if os . path . isdir ( f ) : for s in os . listdir ( f ) : recursive_unlink ( os . path . join ( f , s ) ) os . rmdir ( f ) elif os . path . isfile ( f ) : os . unlink ( f )
deletes f .