How can I get only one level of objects in an S3 bucket?

I want to specify only objects in the bucket that are not the buckets themselves. Is there a way to do this without parsing ListBucket results?

+5
source share
1 answer

objects in a bucket that are not buckets themselves

Buckets cannot contain other buckets. Do you mean folders? S3 also does not have the concept of folders.

You can have 100 buckets per S3 account, and each bucket can contain an unlimited number of objects / files. If you specify files with a name /in the file name, AWS GUI tools (for example, AWS Console, BucketExplorer, etc.) will interpret each section as a virtual folder. eg,

folder1/folder2/myfile.jpg S3 "" , , myfile.jpg 2 folder1/folder2.

prefix delimiter GET Bucket (List Objects). SDK.

UPDATE, .

, S3 :

mybucket
   folder1
      file1.txt
      file2.txt
      folder2
          file3.txt
          file4.txt
      folder3
          file5.txt
          file6.txt

prefix = "folder1/" 6 : file1.txt file6.txt.

prefix = "folder1/", delimiter = "/" 2 :

    file1.txt
    file2.txt

CommonPrefixes

    folder1/folder2/
    folder1/folder3/
+13

All Articles