change_filename.py
import os import glob path = "./input_dir" files = glob.glob(path + '/*') for i, f in enumerate(files): os.rename(f, os.path.join(path, 'new_file-'+'{0:05d}'.format(i) +'.jpg')) # new_file-00000.jpg , new_file-00001.jpg
Recommended Posts