from glob import glob from tqdm import tqdm import shutil import os path = "/home/limmireu/다운로드/All" fileNames = sorted(glob(path+"/*.png")) fileNum = 0 for fileName in tqdm(fileNames[0: 7000]): fileName = os.path.basename(fileName) fileName = fileName.split(".")[0] if fileNum == 7000: break if (os.path.isfile(f"/home/limmireu/다운로드/All/{fileName}.png") and os.path.isfile(f"/home/limmireu/다운로드/All/{fileName}.xml")): shutil.move(f"/home/limmireu/다운로드/All/{fileName}.png", f"/home/limmireu/다운로드/file/{fileName}.png") shutil.move(f"/home/limmireu/다운로드/All/{fileName}.xml", f"/home/limmireu/다운로드/file/{fileName}.xml") fileNum += 2