I am searching how to delete a S3 folder using AWS SDK for Java version 2. I only managed to find AWS SDK version 1 examples.
I know that S3 is an object store and that the concept of folder does not exist. What I mean here is :
- List the S3 objects of a given bucket with a given prefix
- Delete the returned objects using a
DeleteObjectsRequest
to be able to delete up to 1000 objects in a single HTTP call towards AWS API
When I am searching for examples, I constantly go back to this page : https://docs.aws.amazon.com/AmazonS3/latest/dev/DeletingMultipleObjectsUsingJava.html where it seems this is the version 1 of the AWS SDK for Java that is used. At least, on my side, I imported AWS SDK 2 and I cannot directly instantiate DeleteObjectsRequest as it is shown in this example. I am forced to use builders then I don't find the same methods to specify the list of keys to be deleted.