There are hundreds of .xml files. I need to change the .xml files and save with the same name in diff folders.
There are many objects with the same name. Need to change all.
-<object>
<name>hat</name>
<pose>Unspecified</pose>
<truncated>0</truncated>
<difficult>0</difficult>
This is the code I have written in Python. But it's throwing error.
import xml.etree.ElementTree as ET
import os
path = "S:/try" # Source Folder
dstpath = "S:/try1"
try:
    makedirs(dstpath)
except:
    print ("Directory already exist")
for filename in os.listdir(path):
    if filename.endswith('.xml'):
        tree = ET.parse(filename)
        root = tree.getroot()
        for name in root.iter('name'):
            name.text = str('helmet')
        tree.write('%s/%s'%(distpath,filename))
 
    