Wednesday, September 19, 2018

renaming folder contents to another name in sequence order

import os
list=os.listdir("imagexx")
os.chdir("imagexx")
b=0
for i in list:
print(i)
extension=i.split('.')[1]
os.rename(i,"deven"+str(b)+extension)
b=b+1


##file under the location imagexx will automaticallly change under the name of deven1.png in ascending order


No comments:

Post a Comment