isab
isab

Reputation: 11

Amazon S3 list contents of sub folder inside a bucket

I have a bucket names target bucket in s3 s3.incrementally_list_bucket(target_bucket) will help me in listing contents of entire bucket.

But I want to list only the contents of subfolder "users" inside I tried with s3.incrementally_list_bucket(target_bucket/users) but it didnt work

Upvotes: 1

Views: 1703

Answers (1)

art.zhitnik
art.zhitnik

Reputation: 624

I think you should use a prefix. In Python it looks like this:

conn = S3.AWSAuthConnection(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY)
response = conn.list_bucket('target_bucket', {'prefix': 'users'})
for e in response.entries:
    print e.key

Upvotes: 2

Related Questions