title: Remove multiple files using multithreading in Java
body: <p>My application generates a lot of log files, I want to clean this folder each time I startup the application. The simplest way to do that is:</p>
  
  <pre><code>//remove files from the previous executions
  Thread tCleanAppFolder = new Thread() {
  
      public void run() {
          String savePath = getFilesDir().getPath() + File.separator;
          File path = new File(savePath);
          for (File file : path.listFiles()) {
              file.delete();
          }
      }
  };
  tCleanAppFolder.start();
  </code></pre>
  
  <p>Of course, we execute this code in the separate thread for the performance reasons. Now the question, should I remove each file in the separate thread or it's OK to leave the code as it's now? Will the usage of the multiple threads inside of <code>tCleanAppFolder</code> thread boost the cleaning process?</p>
  
  <p>Probably, it's worth to mention, I'm talking about Android application thus, there is no HDD, but internal and external memory of a smartphone.</p>
  
  <p>Thanks.</p>