Quick way to list all files in Amazon S3 bucket?

前端 未结 28 1815
星月不相逢
星月不相逢 2020-11-28 01:32

I have an amazon s3 bucket that has tens of thousands of filenames in it. What\'s the easiest way to get a text file that lists all the filenames in the bucket?

28条回答
  •  眼角桃花
    2020-11-28 02:03

    For Python's boto3 after having used aws configure:

    import boto3
    s3 = boto3.resource('s3')
    
    bucket = s3.Bucket('name')
    for obj in bucket.objects.all():
        print(obj.key)
    

提交回复
热议问题