Oct-29-2019, 07:07 AM
How to ignore folder in the dir.
It's not a big problem but still, I don't want to rename folder also.
It's not a big problem but still, I don't want to rename folder also.
import os
location = input("Enter folder location: ")
def rename(path, name = 'image_0', ext = '.jpg'):
os.chdir(path)
x = 1
for file in os.listdir():
src = file
dst = name + str(x) + ext
os.rename(src, dst)
x += 1
print("Renamed Successfully")
rename(location)
