同步更改数据

This commit is contained in:
dongchangxi committed 2024-07-17 14:46:47 +08:00
1 parent ecb58b2f59
commit 33ba8bb357
21 files changed
+2019472 -63

No files matched your search

+33
View File
@@ -0,0 +1,33 @@
import os
import shutil
folder_path = 'G:\\obj_fix\print'
# 遍历文件夹下的所有文件
# 定义函数来递归遍历文件夹下的所有文件
def list_files(directory):
for root, dirs, files in os.walk(directory):
for file in files:
yield os.path.join(root, file)
nums = 0
for file_path in list_files(folder_path):
if "_preview.png" not in file_path:
continue
print(file_path)
nums += 1
# #提取pid
# arrTemp = file_path.split('\\')
# pid = arrTemp[len(arrTemp)-2]
# #判断 G:\obj_fix\print\wrong\ 文件夹里 是否存在 {pid}_preview.png 文件
# filePath = f'G://obj_fix\print\wrong\{pid}_preview.png'
# #不存在跳过
# if not os.path.exists(filePath):
# continue
# #存在的话就重命名文件
# new_file_path = f'G://obj_fix\print\wrong\{pid}_preview_already_right.png'
# os.rename(filePath, new_file_path)
print(nums)