Python boto, list contents of specific dir in bucket

前端 未结 7 1791
难免孤独
难免孤独 2020-12-13 18:19

I have S3 access only to a specific directory in an S3 bucket.

For example, with the s3cmd command if I try to list the whole bucket:

             


        
7条回答
  •  既然无缘
    2020-12-13 18:46

    If you want to list all the objects of a folder in your bucket, you can specify it while listing.

    import boto
    conn = boto.connect_s3(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY)
    bucket = conn.get_bucket(AWS_BUCKET_NAME)
    for file in bucket.list("FOLDER_NAME/", "/"):
        
    

提交回复
热议问题