I have a backup script, which I take all the objects in a directory, and then with each slice of 30,000 I back them up to S3. My questions is now that I have over 100,000 objects, I would like to skip to slice number 2 but I am unsure how to do that. So the beginning of the loop looks like -
directory.files.each_slice(30000) do |file_array|
directory.files.each_slice(30000).skip(1)
Any thoughts?
Thanks!
each_slice
returns an enumerable which you can then call further enumerable methods on, so you could use with_index
to do something like
directory.files.each_slice(30000).with_index { | file_array, i |
next if i == 2
upload file_array
}