Last active
April 16, 2019 02:17
-
-
Save mrdrozdov/68b68416d5cd5448cea7993a80cd3dfc to your computer and use it in GitHub Desktop.
move-images.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
path_to_old_images = '/unsupervised-old' | |
path_to_new_images = '/unsupervised-new' | |
images_per_directory = 1000 | |
for i, filename in enumerate(os.listdir(path)): | |
if i % images_per_directory == 0: | |
target_dir = os.path.join(path_to_new_images, '{:05}'.format(i)) | |
os.system('mkdir -p {}'.format(target_dir)) | |
source = os.path.join(path_to_old_images, filename) | |
target = os.path.join(target_dir, filename) | |
os.system('cp {} {}'.format(source, target)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment