import os
import re
def rename_batch(path):
for file in os.listdir(path):
fileNew= '_youkushipin_'
fileNew=re.sub(r'_.*?_', fileNew, file, 1, flags=re.I)
if '.pcap' == file[-5:]:
print(fileNew)
os.rename(path+ '\\' + file, path + '\\' + fileNew)
path=r'C:\Users\Administrator\Desktop\svn备份\pcap\优酷视频'
rename_batch(path)
网友评论