36 lines
1.2 KiB
Python
36 lines
1.2 KiB
Python
import os
|
|
import shutil
|
|
|
|
|
|
def merge_folder(folder_path_list, output_folder_path):
|
|
|
|
os.makedirs(output_folder_path, exist_ok=True)
|
|
|
|
for folder_path in folder_path_list:
|
|
folder_name = folder_path.split("/")[-1]
|
|
for file_name in os.listdir(folder_path):
|
|
file_path = os.path.join(folder_path, file_name)
|
|
file_name_new = folder_name + "_" + file_name
|
|
if os.path.isfile(file_path):
|
|
shutil.move(file_path, os.path.join(output_folder_path, file_name_new))
|
|
|
|
if __name__ == "__main__":
|
|
|
|
folder_path_list = [
|
|
'2c7cc83019e7388a7041101da92c9829',
|
|
'3aee64cc1f90d93a5a45979f7b17cb4b',
|
|
'7e82dc1494c43078ea771a7d0535befd',
|
|
'9f0ee60ef8bed75d4e1b8911d45db353',
|
|
'632e474452d560edd7004f745319ff00',
|
|
'd52059567121035b1438551f96e99017',
|
|
'fa473dc61cf47ea7d3b9934fb819546c',
|
|
]
|
|
|
|
base_path = '/home/admin-root/haotian/康达瑞贝斯机器狗/data_image'
|
|
|
|
folder_path_list_new = [os.path.join(base_path, folder_path) for folder_path in folder_path_list]
|
|
|
|
merge_folder(folder_path_list_new, "/home/admin-root/haotian/康达瑞贝斯机器狗/data_image/读表图片")
|
|
|
|
|