#-*-code: UTF-8-*-
Import OS
def rename ():
i = 0
PATH = "E:/TMP/PIC/AA"
filelist = os.listdir (PATH)#All files (including folders) under the folder
For FILES in Filelist: #Prink through all files
I = i+1
Olddir = OS.Path.Join (PATH, FILES) #The original file path
if os.path.isdir (Olddir):#If it is a folder, skip
continue
filename = OS.Path.Splitext (Files) [0] #file name
filetype = OS.Path.Splitext (FILES) [1] #file extension name
Newdir = OS.Path.join (PATH, Str (i)+Filetype) #New file path
Os.rename (Olddir, Newdir) #
rename ()
(Transfer) Python renames file batch renames with python batch of files to the file
2023-03-18