Amazon S3 console: download multiple files at once

后端 未结 15 1299
傲寒
傲寒 2021-01-31 07:00

When I log to my S3 console I am unable to download multiple selected files (the WebUI allows downloads only when one file is selected):

https://console

15条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-31 07:46

    import os import boto3 import json

    s3 = boto3.resource('s3', aws_access_key_id="AKIAxxxxxxxxxxxxJWB", aws_secret_access_key="LV0+vsaxxxxxxxxxxxxxxxxxxxxxry0/LjxZkN") my_bucket = s3.Bucket('s3testing')

    download file into current directory

    for s3_object in my_bucket.objects.all(): # Need to split s3_object.key into path and file name, else it will give error file not found. path, filename = os.path.split(s3_object.key) my_bucket.download_file(s3_object.key, filename)

提交回复
热议问题