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))