Skip to content

Instantly share code, notes, and snippets.

@arfon
Created December 10, 2009 15:51
Show Gist options
  • Save arfon/253405 to your computer and use it in GitHub Desktop.
Save arfon/253405 to your computer and use it in GitHub Desktop.
Upload all files in directory to S3
require "rubygems"
require "net/http"
require "uri"
require "aws/s3"
AWS::S3::Base.establish_connection!(
:access_key_id => 'ACCESS KEY',
:secret_access_key => 'SECRET KEY'
)
Dir.glob('*.jpg').each do |i|
AWS::S3::S3Object.store(
"#{i}",
File.open(i),
"bucket_name",
:content_type => "image/jpeg",
:access => :public_read
)
puts "Done #{i}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment