|
from os import makedirs |
|
from os import listdir |
|
from os.path import join |
|
from shutil import copy |
|
from concurrent.futures import ThreadPoolExecutor |
|
|
|
NUM_FILES = 5000 |
|
|
|
|
|
|
|
|
|
|
|
def copy_file(src_path, dest_dir): |
|
|
|
dest_path = copy(src_path, dest_dir) |
|
|
|
print(f'.copied {src_path} to {dest_path}') |
|
|
|
def main(src='../../AVA_src/images/images/', dest='../../AVA_src/images_5k/'): |
|
|
|
makedirs(dest, exist_ok=True) |
|
|
|
files = [join(src,name) for name in listdir(src)][:NUM_FILES] |
|
print("Files: ",files) |
|
|
|
with ThreadPoolExecutor(10) as exe: |
|
|
|
_ = [exe.submit(copy_file, path, dest) for path in files] |
|
|
|
if __name__ == '__main__': |
|
main() |
|
|