Newbie here. There are many ways to rename files in your folder, however, does anyone know how to rename just a single file incrementally? for example in a folder I have image.jpg, and each time I run the code, it will rename image.jpg in the folder and increment to newimage1.jpg and if the folder contains newimage1 after running the code again, it will rename that file to newimage2.jpg so on and so forth.
import os
os.chdir('C:\\Users\\Desktop\\Folder1')
i=0
for file in os.listdir():
src=file
if src=='image.jpg':
#How do i make use of counter to increment the image name each time i run this code?
dst="newimage.jpg"
os.rename(src,dst)
The code above renames a single file once.