📜  python代码示例中的批量文件名更改器

📅  最后修改于: 2022-03-11 14:46:31.030000             🧑  作者: Mango

代码示例1
# Developed by Sadman Sakib
import os


path = 'C:/Users/N.S Computer/OneDrive/Desktop/temp/'   # Path Directory


i=1

for file in os.listdir(path):
    new_name = 'SSS'+str(i)                 # Setting new unique name
    pre_file_name = path + file             # Obj with pre. fila name % directory
    new_file_name = path + new_name         # Obj with new. fila name % directory

    os.rename(pre_file_name, new_file_name) # Renaming Files
    i += 1                                  # Incrementing Value of i