How to use AWS iOS SDK to delete a folder and all its objects in side bucket?

落花浮王杯 提交于 2020-01-04 05:17:41

问题


I am uploading objects to amazon s3 using AWS iOS SDK in Iphone, sometime error occurs and some of the objects are uploaded, remaining are not uploaded. I have created bucket and inside bucket i have created folder in which i have store my objects. I want to delete folder and all its object. Can anyone help me?


回答1:


First of all, there is not such thing as "folders" in S3. Most S3 clients (including the AWS web console) show them as folders only for convenience (grouping stuff), but in fact, what you see as a "folder name" is merely a prefix.

Being that said, my suggestion to you is using the listObjectsInBucket API call, passing in your "folder name" as prefix in the S3ListObjectsRequest parameter.
When you have obtained all the keys (file names including prefix) matching that prefix, use the deleteObjects API call, passing in the keys in S3ListObjectsRequest parameter.

For more details on folder/prefix and deleting stuff, please see these related links:
Delete files, directories and buckets in amazon s3 java
Thread on AWS forum regarding this subject



来源:https://stackoverflow.com/questions/15022707/how-to-use-aws-ios-sdk-to-delete-a-folder-and-all-its-objects-in-side-bucket

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!