Can i somehow search objects in S3 by extension, not only by prefix?
Here is what i have now:
ListObjectsResponse r = s3Client.ListObjects(new Amazon
Because by using boto3 resource to get objects from S3, you can get satisfied result by using the returned file extension to filter what you want. Like this:
import boto3
s3 = boto3.resource('s3')
my_bucket = s3.Bucket('my_bucket')
files = my_bucket.objects.all()
file_list = []
for file in files:
if file.key.endswith('.docx'):
file_list.append(file.key)
You can change the endswith string with what you want.