S3 C++ remove recursive

Viewed 197

Suppose I have the following on S3:

mybucket/a=1/b=1/1.txt
mybucket/a=1/b=2/2.txt
mybucket/a=2/b=1/3.txt
mybucket/a=2/b=2/4.txt

I am using the C++ SDK, and I would like to be able to specify a bucket and an arbitrary prefix (e.g. "a=1") and have it delete all of the keys with that prefix.

Note:

I am aware of the CLI rm recursive command, but that is not available; it must be implemented with the C++ SDK.

I am also aware of the multiple file delete, and that I could specify keys to a DeleteObjectsRequest, but that is not ideal since the keys to be deleted are not known a priori, so this would require a listing the keys of the bucket with the given prefix, and then populating a request with the resulting keys (or multiple requests, since a single DeleteObjectsRequest can only contain 1000 keys).

So is it possible to delete all of the keys in S3 with a given prefix in the C++ SDK other than with the approach I have described above?

0 Answers
Related