Skip to content

Instantly share code, notes, and snippets.

@kachina
Last active December 10, 2020 02:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kachina/3fb3489a765f58001fb13bb7337a719f to your computer and use it in GitHub Desktop.
Save kachina/3fb3489a765f58001fb13bb7337a719f to your computer and use it in GitHub Desktop.
import os
import boto3
def main():
s3_client = boto3.client('s3')
params = {'Bucket': 'example-bucket'}
while True:
response = s3_client.list_objects_v2(**params)
for content in response['Contents']:
print(content['Key'])
if 'NextContinuationToken' not in response:
break
params['ContinuationToken'] = response['NextContinuationToken']
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment