title: Java copy a folder excluding some internal file
body: <p>I have a folder with this structure</p>
  
  <p>mainFolder</p>
  
  <pre><code>   --Sub1  
           --File .scl
           --File .awl
           --Other files
     --Sub2  
           --Files
     --Sub3
     --Sub4
  </code></pre>
  
  <p>I want to copy it to another location but i want the Sub3 to be avoided and (depending from the situation) some file from the Sub1</p>
  
  <p>Here is an extract from what i did so far:</p>
  
  <pre><code>FileUtils.copyDirectory(srcDir, dstDir, new FileFilter() {
          public boolean accept(File pathname) {
              // We don't want 'Sub3' folder to be imported
              // + look at the settings to decide if some format needs to be
              // excluded
              String[] ignoreList= new String[]{
                      !Settings.getSiemensOptionAWL() ? ".awl":"uselessStringWilNeverBeFound",
                      !Settings.getSiemensOptionSCL() ? ".scl":"uselessStringWilNeverBeFound",
                      "Sub3"
              };
  
              return !(ignoreFile(pathname, ignoreList) &amp;&amp; pathname
                      .isDirectory());
          }
      }, true);
  
  
      public static boolean ignoreFile(File file, String[] ignoreList) {
          for (final String ignoreStr : ignoreList)
              if (file.getAbsolutePath().contains(ignoreStr))
                  return true;
          return false;
      }
  </code></pre>
  
  <p>Apparently it seams to work. But i think is a very ugly solution....
  Does anyone knows a better way?</p>
  
  <p>P.S:
  of course Settings.getSiemensOptionAWL() is just boolean function taht return my decision</p>