Created
September 10, 2012 07:10
-
-
Save boj/3689365 to your computer and use it in GitHub Desktop.
AWS Bucket Copy
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
#!/usr/bin/env ruby | |
# From: http://www.austinriba.com/2011/02/copy-contents-of-one-s3-bucket-to-another/ | |
require 'right_aws' | |
S3ID = "Your AWS ID Here" | |
S3KEY = "Your AWS secret key" | |
SRCBUCKET = "Source Bucket" | |
DESTBUCKET = "Destination Bucket" | |
s3 = RightAws::S3Interface.new(S3ID, S3KEY) | |
s3.incrementally_list_bucket(SRCBUCKET) do |h| | |
h[:contents].each do |o| | |
puts("Copying " + o[:key]) | |
s3.copy(SRCBUCKET, o[:key], DESTBUCKET, o[:key]) | |
end | |
end | |
puts("Done.") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment