AWS S3: List Objects from a specific S3 folder?

Question:

I am using the AWS IOS SDK to download files from S3 and am having trouble listing objects in a specific folder of an S3 bucket. I can list all the files of the ENTIRE bucket using the listObjectsInBucket method but I need to list only the files in a specific folder within a bucket.

So I am trying to use the listObjects method and specify a bucket name and prefix (indicating a folder name on S3).

But the following code is not working.

Answer:

Just simply DO NOT put “/” in front of folderName1, and things will work out.

Swift:

Objective-C:

Leave a Reply