Skip to content

Instantly share code, notes, and snippets.

@mrdrozdov
Last active April 16, 2019 02:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrdrozdov/68b68416d5cd5448cea7993a80cd3dfc to your computer and use it in GitHub Desktop.
Save mrdrozdov/68b68416d5cd5448cea7993a80cd3dfc to your computer and use it in GitHub Desktop.
move-images.py
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