亚马逊 s3 对象按日期过滤

编程入门 行业动态 更新时间:2024-10-24 05:23:14
本文介绍了亚马逊 s3 对象按日期过滤的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

我需要按上次修改日期过滤存储桶内的 s3 对象

I need to filter s3 objects inside a bucket by last modified date

BasicAWSCredentials awsCreds = new BasicAWSCredentials(accessKey, secretKey);
            AmazonS3 s3Client = AmazonS3ClientBuilder.standard()
                    .withCredentials(new AWSStaticCredentialsProvider(awsCreds)).withRegion(Regions.US_EAST_2).build();
ListObjectsV2Result result = s3Client.listObjectsV2(bucketName, date);
                List<S3ObjectSummary> objects = result.getObjectSummaries();
List<S3ObjectSummary> objects = result.getObjectSummaries(); //contains objects

这里在 s3 中,我有一个存储桶.在存储桶内,将有带有日期的文件夹.特定日期的数据累积到相应的日期文件夹中.在日期文件夹中,有 JSON 对象和修改日期.我想获取具有日期范围的 json 对象.

Here In s3, I have a bucket. Inside the bucket, there will be the folder with dates. The data for the particular date accumulated to the corresponding date folder. Inside the date folder, JSON objects and modified date is there.I want to fetch the json objects with date range.

推荐答案

S3 不支持检索按日期过滤的对象列表.

S3 does not support retrieving an object listing filtered by date.

正如@John 上面提到的,您需要遍历列表并评估代码中的过滤条件.

As @John noted above, you will need to iterate through the listing and evaluate the filter condition in your code.

这篇关于亚马逊 s3 对象按日期过滤的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

更多推荐

[db:关键词]

本文发布于:2023-04-23 04:34:03,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1035481.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:亚马逊   对象   按日

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!