Get the list of files from a specific S3 bucket folder

ListObjectsRequest request=new ListObjectsRequest()
                           .withBucketName(bucketName)
                           .withPrefix("files/")
                           .withMarker("files/");
ObjectListing objectListing = s3client.listObjects(request);
   for(S3ObjectSummary os : objectListing.getObjectSummaries()) {
       System.out.print(os.getKey());
}

Get the list of all files from the S3 bucket

 ObjectListing objectListing = s3client.listObjects(bucketName);
    for(S3ObjectSummary os : objectListing.getObjectSummaries()) {
        log.info(os.getKey());
    }

Raman

Related post

Leave a Reply

Your email address will not be published. Required fields are marked *