I try to do a python3 script and i have to delete all .xml in a folder. It's a giant folder with any folders in this folders (etc..).
(in dossier1, i have 2 folders and 2 .xml files, in there 2 folders, i have 2 folders and 2 .xml files etc)
Is it possible to say: "in this folder, search all the .xml and delete them" ?
i tried this:
filelist=os.listdir(path)
for fichier in filelist[:]: # filelist[:] makes a copy of filelist.
if not(fichier.endswith(".xml")):
filelist.remove(fichier)
but python dont't go in differents folders.
Thanks for your help :)