samedi 9 juillet 2016

Check if folder exist in s3 bucket

How can I check if some folder exists in my s3 bucket using ruby on rails?

I’m using AWS:S3 official gem After initializing the global connection

AWS::S3::Base.establish_connection!(:access_key_id => 'my_key_id', :secret_access_key => ‘my_secret’)

I have bucket named: myfirstbucket

With folder inside named: my_folder

With file inside my_folder named : my_pic.jpg

When I try to check if my_pic.jpg exist it work just fine

s3object.exists? “/my_folder/my_pic.jpg” , “myfirstbucket”

=> True

How can I check only if the folder exist ?

s3object = AWS::S3::S3Object

s3object.exists? “/my_folder/” , “myfirstbucket”

=> False

Thanks.

Aucun commentaire:

Enregistrer un commentaire