# multi_rename.py
import os
import shutil
from apscheduler.schedulers.blocking import BlockingScheduler
class Cope_C:
def __init__(self, path, path3):
self.path = path
self.path3 = path3 + '\\重命名之后的文件'
def cpye_change(self):
try:
# 删除目录重新备份
shutil.rmtree(self.path3)
except:
print('')
try:
# 复制文件夹中的文件
shutil.copytree(self.path,self.path3)
except:
print('\n')
print('请输入正确的文件夹路径')
print('\n')
return
else:
file_list = os.listdir(self.path3)
print('==============================================》开始重命名')
# 批量修改后缀
for file in file_list:
if '.' in file:
file_name =os.path.splitext(file)[0]
new_name = file_name + '.ctvvs'
print(new_name)
try:
os.rename(self.path3+'\\'+file,self.path3+'\\'+new_name)
except:
print(new_name+'这个文件已经存在')
new_name = file_name + '.ctvvstt'
os.rename(self.path3 + '\\' + file, self.path3 + '\\' + new_name)
print('=============================================》结束重命名')
print('文件的保存路径为:',self.path3)
# def timing(fu,num):
# min = '*/'+str(num)
# sched = BlockingScheduler()
# # sched.add_job(fu, 'cron', hour=min)
# sched.add_job(fu, 'cron', second= min)
# sched.start()
# def multi_rename(num, path, path3):
# try:
# int(num)
# timing(Cope_C(path, path3).cpye_change,num)
# except:
# print('设置错误不走定时')
# Cope_C(path, path3).cpye_change()
# ui.py
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'ui.ui'
#
# Created by: PyQt5 UI code generator 5.15.7
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file