Ok, I see this and this and documentation telling amazon is flat file system and for to create/get/set folders , one has to use Delimiter='/' and Prefix.
But I didnt get it, I mean I couldnt write the code. So I have a bucket and a folder with some files,I want list of those files
So I tried bucket/folder
, /bucket/folder/
, bucket/folder/
all of this fails.
If I try only bucket
, it works fine
S3ListObjectsRequest *getListObjectsRequest= [[S3ListObjectsRequest alloc] initWithName:@"bucket"]; // tried also here bucket/folder , /bucket/folder/ , bucket/folder/
S3ListObjectsResponse *getListObjectsResponse = [self.s3 listObjects:getListObjectsRequest];
//test to see inside of the folder
NSArray *objectsinamazon = [self.s3 listObjectsInBucket:@"bucket"]; //as I said I tried bucket/folder , /bucket/folder/ , bucket/folder/ all od this fails.
NSLog(@"array is %@",objectsinamazon);
S3ListObjectsResult *listObjectsResults = getListObjectsResponse.listObjectsResult;
for (S3ObjectSummary *objectSummary in listObjectsResults.objectSummaries) {
NSLog(@"Bucket Contents %@:",[objectSummary key]);
//get last modified date of file by using meta data
S3GetObjectMetadataRequest *getMetadataRequest = [[S3GetObjectMetadataRequest alloc] initWithKey:[objectSummary key] withBucket:@"bucket"];
S3GetObjectMetadataResponse *getMetadataResponse = [self.s3 getObjectMetadata:getMetadataRequest];
}
}
I am asking exact syntax(code) to send bucket/folder
request to amazon s3