title: Check if folder exist in s3 bucket
body: <p>How can I check if some folder exists in my s3 bucket using Ruby on Rails?</p>
  
  <p>I’m using AWS:S3 official gem
  After initializing the global connection</p>
  
  <pre><code>AWS::S3::Base.establish_connection!(:access_key_id =&gt; 'my_key_id', :secret_access_key =&gt; ‘my_secret’) 
  </code></pre>
  
  <p>I have bucket named: <code>myfirstbucket</code></p>
  
  <p>With folder inside named: <code>my_folder</code></p>
  
  <p>With file inside my_folder named: <code>my_pic.jpg</code></p>
  
  <p>When I try to check if <code>my_pic.jpg</code> exist it work just fine</p>
  
  <pre><code>s3object.exists? “/my_folder/my_pic.jpg” , “myfirstbucket”
  =&gt;  True
  </code></pre>
  
  <p>How can I check only if the folder exists?</p>
  
  <pre><code>s3object = AWS::S3::S3Object
  s3object.exists? “/my_folder/” , “myfirstbucket”
  =&gt;  False
  </code></pre>