title: Finding files dynamically
body: <p>I want to be able to repeat an action for every file in a directory.</p>
  
  <p>This is my current code</p>
  
  <pre><code>File file = new File("res\\thing.csv");
      BufferedReader reader;
      try {
          reader = new BufferedReader(new FileReader(file));
  
      Dat = new ArrayList&lt;String&gt;();
      String line;
      try {
          while((line = reader.readLine()) != null){
              String[] values = line.split(",");
              for(String s : values) {
                  Dat.add(s);
                  //System.out.println(String.valueOf(Dat));
              }
          }
      }
  catch (IOException e) {
  
          e.printStackTrace();
      }
  
      } catch (FileNotFoundException e1) {
          e1.printStackTrace();
      }
  </code></pre>
  
  <p>It then goes on to change the extracted variables before writing to a new file. How can I get this program to automatically do this for every file in a directory?</p>