While I am aware that I can delete folder using aws s3 rm s3://xyz/abc --recursive
to delete folder contents but I want to know how to do the same using aws s3api
.
Asked
Active
Viewed 206 times
0

jarmod
- 71,565
- 16
- 115
- 122

Debdut Goswami
- 1,301
- 12
- 28
-
s3api has delete-objects which does not utilize --recursive. You'd need to create a list of the objects to be deleted and feed it into xargs. It's possible but will take some fiddling. See [this](https://stackoverflow.com/questions/41733318/how-to-delete-multiple-files-in-s3-bucket-with-aws-cli) and [this one](https://serverfault.com/questions/679989/most-efficient-way-to-batch-delete-s3-files) – kenlukas Oct 06 '21 at 14:25
-
@kenlukas right. That is what I thought too. Was worth the shot. – Debdut Goswami Oct 06 '21 at 16:17
-
@jarmod I mean using `s3api` – Debdut Goswami Oct 24 '21 at 13:58
-
Why do you want to do this via `aws s3api` which is a lower level awscli capability than `aws s3`? – jarmod Oct 24 '21 at 19:26