title: Excluding prefix in ObjectListing results Java client for S3
body: <p>I have a S3 bucket with following hierarchy: </p>
  
  <pre><code>bucketName
      folder1
         file1 
  </code></pre>
  
  <p>I wanted to get all the files from folder1. I tried to do following: </p>
  
  <pre><code>ObjectListing ol = s3Client.listObjects("bucketName", "folder1"); 
  List&lt;S3ObjectSummary&gt; summaries = ol.getObjectSummaries(); 
  </code></pre>
  
  <p>The problem is that summaries contains <code>folder1/</code> and <code>folder1/file1</code>. Where as I was hoping to get just <code>folder1/file1</code>. </p>
  
  <p>Looking around at the internet, I also tried following: </p>
  
  <pre><code>ListObjectsRequest req = new ListObjectsRequest().withBucketBucketName("bucketName").withPrefix("folder1/").withDelimiter("/"); 
  </code></pre>
  
  <p>But this time I got no results back for <code>getObjectSummaries</code> call. When I remove <code>withDelimiter</code> from above I get both <code>folder1\</code> and <code>folder1\file1</code> back. </p>
  
  <p>Is there any way to just get <code>folder1\file1</code> back? </p>
  
  <p>Please let me know. Thanks! </p>