title: Java - How to delete files from a folder in Java?
body: <p>I'm trying to delete files using a for-loop.</p>
  
  <pre><code>for(int i = 0; i &lt; 3; i++) {
  
     String pathName = "test" + i + ".csv";
     boolean success = (new File(pathName)).delete();
  
  }
  </code></pre>
  
  <p>But this code deletes only the first file, but not the other ones.</p>