import os 
import shutil
import glob 
from pathlib import Path


if __name__ == "__main__":
    src_dir = "/mnt/ssd1T/hoanglv/Projects/KIE/DATA/dev_model/Invoice/processed/train/SL_HCM_batch_2_multi_pages"
    tgt_dir = "/mnt/ssd1T/hoanglv/Projects/KIE/DATA/dev_model/Invoice/intermediate/key_information_extraction/"
    num_files = 100

    files = glob.glob(os.path.join(src_dir, "*.jpg"))
    count = 0
    for file in files:
        src_path = os.path.join(src_dir, file)
        tgt_path = os.path.join(tgt_dir, file)
        if os.path.isfile(src_path):
            shutil.copy(src_path, tgt_path)
            count += 1
            if count == num_files:
                break

    print(f"Copied {count} files from {src_dir} to {tgt_dir}")