33 lines
812 B
Python
33 lines
812 B
Python
import os
|
|
import shutil
|
|
import os
|
|
|
|
currentPath = os.getcwd().replace('\\','/') # 获取当前路径
|
|
|
|
# def file_name(file_dir):
|
|
# for root, dirs, files in os.walk(file_dir):
|
|
# print(root) #当前目录路径
|
|
# print(dirs) #当前路径下所有子目录
|
|
# print(files) #当前路径下所有非目录子文件
|
|
|
|
|
|
newpath = currentPath + r"/new"
|
|
os.makedirs(newpath)
|
|
datanames = os.listdir(currentPath)
|
|
list = []
|
|
for i in datanames:
|
|
nameList = i.split("&")
|
|
if(len(nameList) > 1):
|
|
for j in range(4) :
|
|
newName = nameList[0] + "lv" + str(j) + "&" + nameList[1]
|
|
shutil.copy(currentPath +r"/" + str(i),newpath+ r"/" +newName)
|
|
# list.append(i)
|
|
# print(list)
|
|
# file_name(currentPath)
|
|
# num_input = input('成功了,输入任意数字按回车退出')
|
|
|
|
|
|
|
|
|
|
|