AWS IOS SDK v2.0:如何获取存储桶中的所有文件夹,然后从所述文件夹中提取所有文件?

AWS IOS SDK v2.0: How do I get all the folders within a bucket, and then pull all the files from said folders?

看起来 AWSS3TransferManagerDownloadRequest 需要 URL。您可以附加一个存储桶,但我看不到用于附加前缀之类的任何内容的选项。也就是说,我希望能够拉下所有给定存储桶名称的文件夹,然后从所述文件夹中拉出项目。

从技术上讲,Amazon S3 没有 "directories" 的概念。如果您的三个对象具有以下键 abc/01.testabc/02.testabc/03.test,AWS 管理控制台会显示一个名为 abc 的 "directory",并且在该对象中目录,您会找到 01.test02.test03.test.

您可以将 / 设置为 delimiter property and call - listObjects:. Look at the commonPrefixes 以获取 "directories" 的列表。对于上面的示例,commonPrefixes 应该是一个包含 abc.

的数组

然后你可以将prefix设置为abc/并再次调用- listObjects:来获取"directory"下的对象列表。在上面的例子中,它应该 return abc/01.test, abc/02.test, abc/03.test.

对于每个对象,您可以调用- download: with the given key。 (AWSS3TransferManagerDownloadRequestAWSS3GetObjectRequest 的子代)。