Amazon AWS IOS SDK: How to list ALL file names in a FOLDER

后端 未结 1 603
小鲜肉
小鲜肉 2020-11-30 10:06

I\'m using AWS IOS SDK and trying to list all the files in a FOLDER.

This code works to list all files etc in a BUCKET:

-(void) s3DirectoryListing:         


        
相关标签:
1条回答
  • 2020-11-30 10:43

    Amazon S3 is a "flat" file system, meaning it does not have physical folders. "Folders" as you know are simply prefixes added to file names.

    You need to set the prefix property to your request (see the documentation)

    For example, given the following set of files:

    folderName1/fileNameA.txt
    folderName1/fileNameB.txt
    folderName2/folderName3/fileNameC.txt

    If you set prefix with folderName1, and your delimiter with /, you should get only the first two entries.

    Last, but not least, leave your bucketName only with the bucket name :)

    More info at the S3 Developer Guide.

    0 讨论(0)
提交回复
热议问题