This is my 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){}
}
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.