Created
February 26, 2014 17:40
-
-
Save jakelodwick/9234495 to your computer and use it in GitHub Desktop.
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
# This script assumes a dump of images from the Everyday iOS app. | |
# It distributes all images from images/ into N subdirectories, | |
# starting with 1 and proceeding to N. | |
# the intention is to load these images into a video editor | |
# to make a variant of Kalina's videos that shows multiple | |
# images at once. | |
require 'FileUtils' | |
print "Looking for images in folder 'images'... " | |
Dir.chdir("images") | |
images = Dir['*.jpg'].sort_by{ |f| File.mtime(f) } | |
puts "Found #{images.size}." | |
n = 3 | |
c = 0 | |
print "Copying into #{3} subfolders... " | |
images.each do |image| | |
c+=1 | |
folder = (c % n + 1).to_s | |
Dir.mkdir(folder) if !Dir.exists?(folder) | |
FileUtils.copy_entry(image, "#{folder}/#{image}", true) | |
end | |
puts "Done!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment