Listing files in a specific “folder” of a AWS S3 bucket

前端 未结 7 631
耶瑟儿~
耶瑟儿~ 2020-12-24 04:51

I need to list all files contained in a certain folder contained in my S3 bucket.

The folder structure is the following

/my-bucket/users/

        
7条回答
  •  眼角桃花
    2020-12-24 05:24

    you can check the type. s3 has a special application/x-directory

    bucket.objects({:delimiter=>"/", :prefix=>"f1/"}).each { |obj| p obj.object.content_type }
    

提交回复
热议问题