1
votes

Background

  • I have been running a rails 3.X.X app for 2+ years on Heroku.
  • User-uploaded images are stored in an Amazon S3 bucket via Paperclip.

What I Need

  • I want to download all images that have been uploaded (around 5000 images total) to a local disk.
  • I'd like to reduce the cost required to perform this query.

Problem

  • My knowledge of how Paperclip stores files on S3 has escaped me (the app was written almost 3 years ago).
  • Viewing the bucket's content within the S3 console lists what appears to be meta-data text-files containing a link to the image.
  • I can't seem to find any image files within the bucket itself (via the S3 web console).

Solutions?

  • I've tried various applications like Cyberduck and Buckets but they all time out trying to request the bucket's content.
  • It seems odd that my production bucket only contains meta-data text files describing an image's location; why can't I see the images in the console itself?
  • Is there some easy script I can run to grab all images?
1

1 Answers

1
votes

Can you provide some additional information about your has_attached_file method declared in your model?

You could do something like this assuming you have has_attached_file :photo:

Model.find_each do |record|
  puts record.photo.url
end

puts will obviously just show you the URL. You'll want to script iterating over the list and fetching them with curl or wget.