Skip to content

Instantly share code, notes, and snippets.

@akiraak
Created August 16, 2010 09:43
Show Gist options
  • Save akiraak/526706 to your computer and use it in GitHub Desktop.
Save akiraak/526706 to your computer and use it in GitHub Desktop.
#!/usr/bin/python
import glob
import os
no = 1 # 連番の最初の数字
files = glob.glob('*.jpg')
for file in files:
file = './' + file
new_file = '{0:04}'.format(no) + '.jpg'
print './' + file + ' -> ' + new_file
os.rename(file, new_file)
no = no + 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment