Amazon S3: How to get a list of folders in the bucket?

前端 未结 5 1039
野趣味
野趣味 2021-01-02 10:01

All that I found, it\'s this method GET Bucket But I can\'t understand how can I get only a list of folders in the current folder. Which prefix and delimiter I need to use?

5条回答
  •  囚心锁ツ
    2021-01-02 10:30

    Using prefix of the/path/to/read/ (note that there is no leading slash, but there is a trailing slash), and delimiter of /, you'll find all the folders within that folder inside .

    CommonPrefixes

    A response can contain CommonPrefixes only if you specify a delimiter. When you do, CommonPrefixes contains all (if there are any) keys between Prefix and the next occurrence of the string specified by delimiter. In effect, CommonPrefixes lists keys that act like subdirectories in the directory specified by Prefix. For example, if prefix is notes/ and delimiter is a slash (/), in notes/summer/july, the common prefix is notes/summer/. All of the keys rolled up in a common prefix count as a single return when calculating the number of returns. See MaxKeys.

    http://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketGET.html

提交回复
热议问题