title: Java Globbing Pattern to Match Directory and File
body: <p>I'm using a recursive function to traverse files under a root directory. I only want to extract <code>*.txt</code> files, but I don't want to exclude directories. Right now my code looks like this:</p>
  
  <pre><code>val stream = Files.newDirectoryStream(head, "*.txt")
  </code></pre>
  
  <p>But by doing this, it will not match any directories, and the <code>iterator()</code> gets returned is <code>False</code>. I'm using a Mac, so the noise file that I don't want to include is <code>.DS_STORE</code>. How can I let <code>newDirectoryStream</code> get directories and files that are <code>*.txt</code>? Is there a way?</p>