Last active
February 22, 2017 15:18
-
-
Save lucasrcezimbra/69299594950864f46f8390c1227d2776 to your computer and use it in GitHub Desktop.
Script to rename images for gallery
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 | |
files = sorted(os.listdir()) | |
cont = 1 | |
new_names = [] | |
for filename in files: | |
new_name = '{:03d}.{}'.format(cont, filename[-3:]) | |
new_names.append(new_name) | |
os.rename(filename, new_name) | |
cont+=1 | |
print(new_names) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment