Reputation: 12417
I would like to get all the file names and their sizes from the a particular folder of a Amazon S3 bucket. I can reach the folder with the following code, but, cant get the fiels inside.
public void GetListOfAllS3Objects() {
System.out.println("Listing objects from the destination bucket");
ObjectListing objectListing = s3Client.listObjects(new ListObjectsRequest().withBucketName("my-destination-bucket"));
for (S3ObjectSummary objectSummary : objectListing.getObjectSummaries()) {
System.out.println(" - " + objectSummary.getKey() + " " +
"(size = " + objectSummary.getSize() + ")");
}
}
To make the question more clear, I have a folder name "molomics" inside the mentioned bucket and I have some json
and xml
file there. I would like to get the names for all the files.
How to do that in the most easy way ?
Upvotes: 3
Views: 8212