"No one is harder on a talented person than the person themselves" - Linda Wilkinson ; "Trust your guts and don't follow the herd" ; "Validate direction not destination" ;

December 03, 2020

Simple Utility - File Renumbering

import os
for dir, subdirs, files in os.walk(r'E:\\Dataset'):
i = 0
try:
for f in files:
f_new = str(i) + '.jpg'
i = i+1
print(dir + '\\' + f_new)
try:
os.rename(dir + '\\' + f,dir + '\\' + f_new)
except:
pass
except:
pass

 


Script to renumber files in all subdirectories. Bookmarking it for future use.

Keep Learning!!!

No comments: