我从AWS S3上传和下载文件。麻烦的是,我必须按名称指定每个文件。我希望能够下载特定存储桶(目录)中的所有文件,而无需单独命名。
我目前使用此代码:
s3Client = [[AmazonS3Client alloc] initWithAccessKey:ACCESS_KEY withSecretKey:SECRET_KEY];
getObjectRequest = [[S3GetObjectRequest alloc] initWithKey:arrayName withBucket:bucketName];
getObjectResponse = [s3Client getObject:getObjectRequest];
答案 0 :(得分:2)
S3ListObjectsRequest *listObjectRequest = [[[S3ListObjectsRequest alloc] initWithName:"YourBucket"] autorelease];
S3ListObjectsResponse *listObjectResponse = [[AmazonClientManager s3] listObjects:listObjectRequest];
S3ListObjectsResult *listObjectsResults = listObjectResponse.listObjectsResult;
for (S3ObjectSummary *objectSummary in listObjectsResults.objectSummaries) {
NSLog(@"Bucket Contents %@ " ,[objectSummary key]);
}