I have some code which adds the word \"_manual\" onto the end of a load of filenames..
I need to change the script so that it deletes the last two letters of the filename (ES)
import os
pathiter = (os.path.join(root, filename)
for root, _, filenames in os.walk(folder)
for filename in filenames
)
for path in pathiter:
newname = path.replace('ES.txt', '_ES_manual.txt')
if newname != path:
os.rename(path,newname)