I need to fetch a list of items from S3 using Boto3, but instead of returning default sort order (descending) I want it to return it via reverse order.
I know you can do it via awscli:
aws s3api list-objects --bucket mybucketfoo --query "reverse(sort_by(Contents,&LastModified))"
and its doable via the UI console (not sure if this is done client side or server side)
I cant seem to see how to do this in Boto3.
I am currently fetching all the files, and then sorting...but that seems overkill, especially if I only care about the 10 or so most recent files.
The filter system seems to only accept the Prefix for s3, nothing else.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…