public void deleteDirectory(View view) {
File download = new File(Environment.getExternalStorageDirectory().getAbsolutePath()+"Download");;
if(download.exists()) {
Log.i("TAG",""+download.exists());
Log.i("TAG",download.getAbsolutePath());
File[] files = download.listFiles();
Log.i("TAG",""+files.length);
for(int i=0; i<files.length; i++) {
if(files[i].isDirectory()) {
File Dir = new File(files[i].getAbsolutePath());
File[] filesInDir = Dir.listFiles();
//Elimina archivos de directorio.
for(int j = 0; j < filesInDir.length; j++){
Log.i("TAG", "Elmina en dir " + filesInDir[j]);
filesInDir[j].delete();
}
}
else {
//Elimina archivo.
Log.i("TAG", "Elmina archivo " + files[i]);
files[i].delete();
}
}
}
}
I need to delete all the files that are in the Android download folder, but it does not show more than the log of the permission to read, in addition to a warning that says "File.delete() is ignore"