title: Unable to Access files in Directory
body: <p>I have a directory structure as follows:</p>
  
  <pre><code>DB_SET
   -D1
     - DB_1.txt
   -D2
     - DB_2.txt 
   -D3
     - DB_3.txt
   -D4
     - DB_4.txt
   -D5
     - DB_5.txt
  </code></pre>
  
  <p>I want to store all <code>DB_1.txt</code>, <code>DB_2.txt</code>, <code>DB_3.txt</code>, <code>DB_4.txt</code>, <code>DB_5.txt</code> in an <code>ArrayList</code>. How can I do this?
  My Partial code:</p>
  
  <pre><code>File folder = new File("./WebContent/datasets/DB_Set/");
  File[] listOfFiles = folder.listFiles();
  System.out.println("listofFiles: "+listOfFiles);
  ArrayList&lt;File&gt; sub_dir = new ArrayList&lt;File&gt;();
  for (int i = 0; i &lt; listOfFiles.length; i++) {
      if (listOfFiles[i].isFile()) {
          System.out.println("File " + listOfFiles[i].getName());
        }
      else if (listOfFiles[i].isDirectory()) {
          sub_dir.add(listOfFiles[i]);
      }
  }
  </code></pre>