import os
import shutil
import tqdm
initial_file_path = 'G:/A_Data/KITTI_car_coco/label/'
final_file_path = 'G:/A_Data/KITTI_car_coco/val_label/'
reference_file_path = 'G:/A_Data/KITTI_car_coco/val/val.txt'
file_list = os.listdir(initial_file_path)
file = open(reference_file_path, 'r', encoding='UTF-8')
for line in tqdm.tqdm(file.readlines()):
curLine = line.strip().split(" ")
filename = curLine[0]
for search_file in file_list:
if os.path.splitext(search_file)[0] == filename:
shutil.copy(initial_file_path + '\\' + search_file, final_file_path)
break
|