I am trying to download a latest file from a specific folder in the S3
bucket.
client = boto3.client('s3')
bucket_key = 'test-bucket'
s3 folder path = 'test-bucket/Parag'
Any help would be greatly appreciated.
Thank you
Try this:
import boto3
s3 = boto3.client('s3')
objs = s3.list_objects_v2(Bucket='test-bucket')['Contents']
latest = max(objs, key=lambda x: x['LastModified'])
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.