Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save anatolijd/9935211 to your computer and use it in GitHub Desktop.
Save anatolijd/9935211 to your computer and use it in GitHub Desktop.
require 'fog'
bucket = 'bucket-name'
credentials = {
:provider => 'AWS',
:aws_access_key_id => 'access_key_id',
:aws_secret_access_key => 'secret_key',
}
fog = Fog::Storage.new(credentials)
files = fog.directories.get(bucket).files.map{ |file| file.key }
fog.delete_multiple_objects(bucket, files) unless files.empty?
fog.delete_bucket(bucket)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment