Created
October 30, 2019 11:30
-
-
Save choowilson/c0a9cadf5c92ea1c64911a26cd1281b5 to your computer and use it in GitHub Desktop.
simple python script to rename all files in a directory
This file contains hidden or 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 | |
source_dir="red2" | |
list = os.listdir(source_dir) | |
print(list) | |
for index,filename in enumerate(list): | |
src = os.path.join(source_dir,filename) | |
dst = os.path.join(source_dir,"red"+str(index)+".jpg") | |
os.rename(src,dst) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment