Skip to content

Instantly share code, notes, and snippets.

@taylorlapeyre
Created December 20, 2012 04:29
Show Gist options
  • Save taylorlapeyre/4342968 to your computer and use it in GitHub Desktop.
Save taylorlapeyre/4342968 to your computer and use it in GitHub Desktop.
IMAGE_DIRECTORY = '/images'
def determine_image_location
for base_directory in IMAGE_DIRECTORY
for 2nd_level_directory in base_directory
if number_of_files_in(2nd_level_directory) < 100
return 2nd_level_directory.name
end
if number_of_files_in(base_directory) < 100
return base_directory.name
end
end
raise "All directories are full"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment