Answers for "how to rename files using python within a directory"

0

rename files in a folder python

import os
for dirname in os.listdir("."):
    if os.path.isdir(dirname):
        for i, filename in enumerate(os.listdir(dirname)):
            os.rename(dirname + "/" + filename, dirname + "/" + str(i) + ".bmp")
Posted by: Guest on June-24-2021

Code answers related to "how to rename files using python within a directory"

Python Answers by Framework

Browse Popular Code Answers by Language