#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import shutil
import os,sys
oldfile = '/data_2/project/auto-test/2020-05-12-19-36-26_result.xlsx'
newfile = '/data_2/project/auto-test/test/2020-05-12-19-36-26_result.xlsx'
shutil.copyfile(oldfile, newfile) # 复制
#shutil.move(oldfile, newfile) # 移动
if(os.path.exists(oldfile)):
os.remove(oldfile)
print("已删除之前的测试报告")
# print '移除后test 目录下有文件:%s' %os.listdir(dirPath)
else:
print("要删除的文件不存在!")
python复制、移动、删除文件
最新推荐文章于 2022-07-03 13:46:37 发布