Skip to content

Instantly share code, notes, and snippets.

@amatthies
Created June 29, 2015 21:46
Show Gist options
  • Save amatthies/c7a31688d06fdb131712 to your computer and use it in GitHub Desktop.
Save amatthies/c7a31688d06fdb131712 to your computer and use it in GitHub Desktop.
List the top folders of a s3 bucket using boto3. https://github.com/boto/boto3/issues/134
import boto3
client = boto3.client('s3')
paginator = client.get_paginator('list_objects')
for result in paginator.paginate(Bucket='edsu-test-bucket', Delimiter='/'):
for prefix in result.get('CommonPrefixes'):
print(prefix.get('Prefix'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment