Created
April 12, 2012 22:30
-
-
Save jaimeiniesta/2371467 to your computer and use it in GitHub Desktop.
Revisions
-
jaimeiniesta created this gist
Apr 12, 2012 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,27 @@ require 'right_aws' s3_credentials = { :source_key => "...", :source_secret => "...", :source_bucket => "...", :destination_key => "...", :destination_secret => "...", :destination_bucket => "..." } puts "Start copying files..." s3_source = RightAws::S3.new(s3_credentials[:source_key], s3_credentials[:source_secret]) source_bucket = s3_source.bucket(s3_credentials[:source_bucket]) s3_destination = RightAws::S3.new(s3_credentials[:destination_key], s3_credentials[:destination_secret]) destination_bucket = s3_destination.bucket(s3_credentials[:destination_bucket]) source_bucket.keys.each_with_index do |source_file, i| puts "#{i}.- Copying #{source_file.name} to #{s3_credentials[:destination_bucket]}" destination_file = RightAws::S3::Key.create(destination_bucket, source_file.name) destination_file.put(source_file.data) end puts "Finished!"