江西省程力&依維柯得意救護車軸距及相關信息
江西省程力&依維柯得意救護車軸距及相關信息江西省程力&依維柯得意救護車軸距是指依維柯底盤上由程力專...
程力專汽2025-04-29 23:52:270次
# -*- coding: utf-8 -*-
import os
import csv
import shutil
import time
def move_files_according_to_record():
current_directory = os.path.dirname(os.path.abspath(__file__))
move_directory = os.path.join(current_directory, "移動")
if not os.path.exists(move_directory):
os.mkdir(move_directory)
record_file_path = os.path.join(current_directory, "發布記錄.csv")
moved_file_path = os.path.join(current_directory, "移動記錄.csv")
# 讀取已經移動的文件列表
moved_files = set()
if os.path.exists(moved_file_path):
with open(moved_file_path, "r", encoding="utf-8") as moved_file:
reader = csv.reader(moved_file)
for row in reader:
moved_files.add(row[0])
# 讀取發布記錄文件并移動文件
with open(record_file_path, "r", encoding="utf-8", newline='') as record_file:
reader = csv.reader(record_file)
for row in reader:
filename = row[0]
source_file_path = os.path.join(current_directory, filename)
destination_file_path = os.path.join(move_directory, filename)
if os.path.exists(source_file_path) and filename not in moved_files:
try:
shutil.move(source_file_path, destination_file_path)
print(f"已移動文件: {filename}")
# 記錄移動成功的文件名
with open(moved_file_path, "a", encoding="utf-8", newline='') as moved_file:
writer = csv.writer(moved_file)
writer.writerow([filename])
except Exception as e:
print(f"移動文件{filename}時出現錯誤:{e}")
else:
print(f"未發現{filename},移動失敗。")
if __name__ == "__main__":
move_files_according_to_record()
上一篇:滁州市軍用方艙品牌排行榜前10名
下一篇:?關鍵詞,生成文章結果
1 臺灣省軍用方艙品牌排行榜前5名 2025-04-30
2 賀州市軍用方艙品牌排名 2025-04-30
3 銅川市軍用方艙品牌排名 2025-04-30
4 淮安市軍用方艙品牌排行榜前3名 2025-04-30
5 昆玉市軍用方艙品牌排行榜前10名 2025-04-30
6 太原市軍用方艙生產廠家品牌排行榜 2025-04-30
7 克孜勒蘇柯爾克孜軍用方艙生產廠家品牌排名 2025-04-30
8 信陽市軍用方艙品牌排行榜前3名 2025-04-30
9 盤錦市軍用方艙生產廠家品牌排行榜前5名 2025-04-30
10 鹽城市軍用方艙生產廠家品牌排名 2025-04-30
江西省程力&依維柯得意救護車軸距及相關信息江西省程力&依維柯得意救護車軸距是指依維柯底盤上由程力專...
陽泉市程力&依維柯得意救護車方式陽泉市程力&依維柯得意救護車方式指的是使用程力汽車集團股份有限公司...
撫順市程力&依維柯得意救護車一輛特價撫順市程力&依維柯得意救護車一輛特價,您所需要的內容如下:車輛...
鞍山市程力&依維柯得意救護車評論近年來,鞍山市程力&依維柯得意救護車在中國醫療行業中備受關注。程力...
海口市程力&依維柯得意救護車電源海口市程力&依維柯得意救護車電源是程力汽車集團股份有限公司以南京汽...