i'm trying to erase all indexes (characters) except the last 4 ones and the files' extension in python. for example: a2b-0001.tif to 0001.tif a3tcd-0002.tif to 0002.tif as54d-0003.tif to 0003.tif
Lets say that folders "a", "b" and "c" which contains those tifs files are located in D:\photos
- there many of those files in many folders in D:\photos
that's where i got so far:
import os
os.chdir('C:/photos')
for dirpath, dirnames, filenames in os.walk('C:/photos'):
os.rename (filenames, filenames[-8:])
why that' not working?