Hi there again. I'm not able to delete the directory, only passing the programm 3 times it do:
how my method works:
1st time: delete all files
2nd time: delete all directories, but no the file that invoke the method
3nd time: delete the first directory
how my method should work:
1st time : delete all files and directories and the file that invoke, recursively
static void deleteAll(File path){ if(path.isDirectory()){ //Found this condition (at the web) to delete own file that invoke but doesn't work for me if(path.list().length == 0){ //Recursion end rule path.delete(); return; } File[] directorio = path.listFiles(); for(int i=0; i<directorio.length ;i++){ //Recursion rule deleteAll(directorio[i]); } } //Recursion end rule else if(path.isFile()) path.delete(); }
Thank you in advance