Skip to content

Instantly share code, notes, and snippets.

@jmontross
Created May 24, 2013 23:46
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jmontross/5647271 to your computer and use it in GitHub Desktop.
Save jmontross/5647271 to your computer and use it in GitHub Desktop.
how to get more than 1000 s3 assets using fog gem in ruby
storage = Fog::Storage.new({:provider => 'AWS', :aws_access_key_id => ACCESS_KEY_ID, :aws_secret_access_key => SECRET_ACCESS_KEY})
files = storage.get_bucket("lessonOverFlow",{'max-keys' =>'100000'})
truncated = files.body['IsTruncated']
the_response = files.body['Contents']
while truncated
files = storage.get_bucket("lessonOverFlow",{'max-keys' =>'100000', 'marker' => files.body['Contents'].last["Key"]})
truncated = files.body['IsTruncated']
the_response = the_response + files.body['Contents']
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment