Batch modify all files in a folder
# Batch modify all.jpg files in a folder
import os
os.chdir('E:/testPython')
i=3
for item in [x for x in os.listdir(".")]:
if os.path.isfile(item) and os.path.splitext(item)[1] = ='.jpg':
os.rename(item,'%s.jpg' %(i))
i=i+1
Copy the code