Advertisement
Guest User

Untitled

a guest
Apr 26th, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. import os
  2.  
  3.  
  4. path_to_old_images = '/unsupervised-old'
  5. path_to_new_images = '/unsupervised-new'
  6. images_per_directory = 1000
  7.  
  8. for i, filename in enumerate(os.listdir(path)):
  9. if i % images_per_directory == 0:
  10. target_dir = os.path.join(path_to_new_images, '{:05}'.format(i))
  11. os.system('mkdir -p {}'.format(target_dir))
  12. source = os.path.join(path_to_old_images, filename)
  13. target = os.path.join(target_dir, filename)
  14. os.system('cp {} {}'.format(source, target))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement