Created
January 3, 2017 17:14
-
-
Save Techbrunch/cfb0c0d93239d7599c5f2e6288449dc1 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
import boto3 | |
prefix = "" | |
bucket = "" | |
client = boto3.client('s3') | |
paginator = client.get_paginator('list_objects') | |
operation_parameters = {'Bucket': bucket, | |
'Prefix': prefix} | |
page_iterator = paginator.paginate(**operation_parameters) | |
for page in page_iterator: | |
keys = page['Contents'] | |
for key in keys: | |
print key['Key'] | |
client.download_file(bucket, key['Key'], key['Key'].replace('/', '-')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment