You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

41 lines
1.4 KiB

import os
import shutil
# 输入输出文件路径
input_file = r'D:\计量经济学\计量实验资料及作业要求\计量实验资料及作业要求\图文帖子原始信息计量实验使用.xlsx'
output_file = r'D:\计量经济学\计量实验资料及作业要求\计量实验资料及作业要求\图文帖子实验数据(新).xlsx'
print("========================================")
print(" 简单文件复制脚本")
print("========================================")
print(f"输入文件: {input_file}")
print(f"输出文件: {output_file}")
print()
# 检查文件是否存在
if not os.path.exists(input_file):
print("错误: 输入文件不存在!")
exit(1)
print(f"文件大小: {os.path.getsize(input_file) / 1024:.2f} KB")
print(f"文件存在: {os.path.exists(input_file)}")
# 复制文件
try:
print("正在复制文件...")
shutil.copy2(input_file, output_file)
# 验证文件是否创建成功
if os.path.exists(output_file):
print(f"文件已成功复制到: {output_file}")
print(f"复制文件大小: {os.path.getsize(output_file) / 1024:.2f} KB")
else:
print("错误: 文件复制失败,未找到输出文件")
print()
print("========================================")
print(" 任务完成")
print("========================================")
except Exception as e:
print(f"处理文件时出错: {str(e)}")