This program is supported under Windows and Linux
The following programs can modify the file suffix name in bulk:
#!/usr/bin/env python
#coding: UTF8
#批量修改一个文件下的文件后缀
sys
os
Rename ():
#Path = "z:\\test\\" # Windows file directory
Path = raw_input ("Please enter the directory you want to manipulate (format like ' z:\\test '):")
FileList = Os.listdir (Path)
filelist:
olddir = Os.path.join (path,files)
files
#打印出老的文件夹里的目录和文件 os.path.isdir (olddir): #判断是否是文件, is a file that skips
Continue
filename = os.path.splitext (files) [0] #filetype
= os.path.splitext (Files ) [1]
newdir = os.path.join (Path,filename + '. jpg ') #只要修改后缀名就可以更改成任意想要的格式
os.rename (Olddir,newdir)
Rename ()
Newdir = Os.path.join (Path,str (Random.randint (1,1000)) +filetype) #可以修改文件名为随机名称
Is that the file already has an error, the file to be changed to the name already exists, to change a conflicting name on it.