my_dir = # enter the dir name for fname in os.listdir(my_dir): if fname.startswith("version"): os.remove(os.path.join(my_dir, fname))
import os, glob for filename in glob.glob("mypath/version*"): os.remove(filename)