This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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:
Post a Comment