Skip to content
This repository has been archived by the owner on Dec 10, 2019. It is now read-only.

Commit

Permalink
Create getS3Files.py
Browse files Browse the repository at this point in the history
  • Loading branch information
davidbailey committed May 11, 2016
1 parent c3fc6b5 commit 97c44ee
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions getS3Files.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import s3

bucket_name = 'your-bucket'
local_directory = '/Users/user/Desktop/directory/'

connection = s3.S3Connection(access_key_id='', secret_access_key='', region='us-west-2', endpoint='s3-us-west-2.amazonaws.com', default_bucket=bucket_name)
storage = s3.Storage(connection)

for bucket in storage.bucket_list():
print bucket.name, bucket.creation_date

for key in storage.bucket_list_keys(bucket_name):
remote_name = s3.S3Name(key.key, bucket=bucket_name)
try: storage.read(remote_name, local_directory + key.key)
except: print "error: " + key.key

0 comments on commit 97c44ee

Please sign in to comment.