2
3

More than 3 years have passed since last update.

ファイル名一括変更

Last updated at Posted at 2020-01-10
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

2
3
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
3