Created
November 27, 2012 08:32
-
-
Save futoase/4153135 to your computer and use it in GitHub Desktop.
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 python | |
# -*- coding:utf-8 -*- | |
# http://stackoverflow.com/questions/3140779/how-to-delete-files-from-amazon-s3-bucket | |
import sys | |
from boto.s3.connection import S3Connection | |
from boot.s3.bucket import Bucket | |
ACCESS_KEY = '' | |
SECRET_KEY = '' | |
if __name__ == '__main__': | |
if (sys.argv) == 1: | |
sys.exit(1) | |
con = S3Connection(ACCESS_KEY, SECRET_KEY) | |
b = Bucket(con, sys.argv[1]) | |
for x in b.list(): | |
b.delete_key(x.key) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment