no pressure, no pressure - I thought of a simple solution like
import os search_string = 'HERE_YOUR_STRING' i = 0 for root, dirs, files in os.walk('C:\\WHAT_EVER_DIR\\'): # take care of double backslash like c:\\temp\\dir1\\ for file in files: fname, ext = os.path.splitext(file) if ext == '.xml': i+=1 full_path = os.path.join(root, file) with open(full_path) as f: s = f.read() s = s.replace(search_string, search_string + str(i)) with open(full_path, "w") as f: f.write(s)but now, maybe an windows api solution?? ;-))
Cheers
Claudia