title: How to delete all files in a directory java android app? Current code is deleting the that folder
body: <p>This is my code</p>
  
  <pre><code>private final static String Dir = "/data/data/org.xbmc.kodi/cache/";
  private void deleteDir(){
      try{
          /*File dir = Utils.getCacheDir(null, this, false, true);
          File path = new File(dir.getParentFile(), Dir);
          delete(path);*/
          String command = "rm -r "+Dir;
          Process process = Runtime.getRuntime().exec("su");
          DataOutputStream os = new DataOutputStream(process.getOutputStream());
          os.writeBytes(command + "\n");
          os.writeBytes("exit\n");
          os.flush();
          process.waitFor();
      }catch(Exception e){}
  }
  </code></pre>
  
  <p>The issue is when I run this it deletes the folder. But I don't want to delete the folder. I want to delete all the files inside it.</p>