Created
September 9, 2020 20:23
-
-
Save aliyevorkhan/00fff31cf9cfa46b5d6f42b0d061c009 to your computer and use it in GitHub Desktop.
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 | |
import datetime | |
from time import sleep | |
for file in os.listdir(os.getcwd()): | |
if file.endswith('.jpg'): | |
os.rename(file, "img_"+datetime.datetime.now().strftime("%Y%m%d-%H%M%S%f")+'.jpg') | |
sleep(0.05) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
this script is able to change image file names in current directory
for unique names I used datetime
for avoid race conditions I used sleep function in time library