Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist
View everday_subdivide.rb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
# 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
Something went wrong with that request. Please try again.