Siddhanta Rath
Siddhanta Rath

Reputation: 1036

How to get list of objects from s3 bucket sorted by last modified timestamp using minio-go api?

I went through the documentation of minio-go-api. But didn't get any solution for that, as objects are sorted based on the alphabetic order.

A hack way, will be to first read all the objects and then take last modified date from each object and form the new list, which is not at all feasible for production

Upvotes: 2

Views: 6672

Answers (2)

r1j1m1n1
r1j1m1n1

Reputation: 407

@Siddhanta Rath, One way to handle this is to use mc tool. Command mc find --newer and mc find --older will handle this. But internally, it will do listObjects and do the sorting for you.

The other approach would be to subscribe to notification and make sure that there is a list of uploaded objects in a database.

Upvotes: 1

John Rotenstein
John Rotenstein

Reputation: 270114

There is no capability to specify sort order in the Amazon S3 API. Your application will need to sort the objects into the desired oder.

Upvotes: 0

Related Questions