Following is the Python program which will Change filename for all files present in a specific folder. Following is the code.
import glob
import os
path = 'path to folder'
i=1
for i, filename in enumerate(glob.glob(path + '*.xlsx')):
os.rename(filename, os.path.join(path, 'QA_Scenario_1__' + str(i+1) + '.xlsx'))
j=i
for j, filename in enumerate(glob.glob(path + '*.xls')):
os.rename(filename, os.path.join(path, 'Testing_Scenario_1__' + str(j+1) + '.xls'))
Comments
Post a Comment