Created
October 17, 2012 11:41
-
-
Save everm1nd/3905084 to your computer and use it in GitHub Desktop.
Clear S3 Bucket
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 'aws' | |
require 'trollop' | |
opts = Trollop::options do | |
opt :config, "amazon.yml config file path", :type => :string, :required => true | |
opt :bucket, "bucket name", :type => :string, :required => true | |
end | |
AWS.config(YAML.load(File.read(opts[:config]))) | |
S3 = AWS::S3.new | |
bucket = S3.buckets[opts[:bucket]] | |
if bucket.exists? | |
puts "Cleaning bucket #{opts[:bucket]}" | |
bucket.objects.delete_all | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment