Created
December 10, 2009 15:51
-
-
Save arfon/253405 to your computer and use it in GitHub Desktop.
Upload all files in directory to S3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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