How to list objects by extension from s3 api?

前端 未结 6 768
醉话见心
醉话见心 2021-01-11 16:08

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         


        
6条回答
  •  無奈伤痛
    2021-01-11 16:21

    You don't actually need a separate database to do this for you.

    S3 gives you the ability to list objects in a bucket with a certain prefix. Your dilemma is that the ".xls" extension is at the end of the file name, therefore, prefix search doesn't help you. However, when you put the file into the bucket, you can change the object name so that the prefix contains the file type (for example: XLS-myfile.xls). Then, you can use the S3 API listObjects and pass a prefix of "XLS".

提交回复
热议问题