title: How to get list of files with specified extensions and excluding few directories?
body: <p>I need to list files(specified extensions) from a directory excluding a few subdirectories.</p>
  
  <p>I'm able to filter with extensions but not with two conditions
  1) Files should be filtered by extension
  2) Should exclude few subdirectories</p>
  
  <pre><code>    File dir = new File("D:\\SomeDir");
      String[] extensions = new String[] { "txt", "java" };
      List&lt;File&gt; files = (List&lt;File&gt;) FileUtils.listFiles(dir, extensions, true);
      for (File file : files) {
          System.out.println("file: " + file.getCanonicalPath());
      }
  </code></pre>
  
  <p>How to exclude selected subdirectories?</p>