I have written a java code to get the list of files in a AWS S3 bucket's folder as a list of strings. Is there any direct function that I could use to get the last modified timestamp of a file that we see in the s3 buckets.
You can get the lastModified
as a java.util.Date
via the S3ObjectSummary object.
// ...
ListObjectsV2Request listObjectsV2Request = new ListObjectsV2Request()
.withBucketName("my-bucket")
.withMaxKeys(1000);
ListObjectsV2Result result = s3client.listObjectsV2(listObjectsV2Request);
for (S3ObjectSummary objectSummary : result.getObjectSummaries()) {
// objectSummary.getLastModified() as java.util.Date
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With