public static boolean deleteRecursively(File f){
  boolean done=false;
  if (f.isFile()) {
    f.delete();
    return true;
  }
  if (f.isDirectory()) {
    File[] list=f.listFiles();
    if (list.length < 0) {
      Logger.appendLog("[FilesUtils][I] deleting " + f.getAbsolutePath());
      return f.delete();
    }
 else {
      for (      File file : list) {
        deleteRecursively(file);
      }
      return f.delete();
    }
  }
  return done;
}

public static boolean deleteRecursively ( File f ) { boolean done = false ; if ( f . isFile ( ) ) { f . delete ( ) ; return true ; } if ( f . isDirectory ( ) ) { File [ ] list = f . listFiles ( ) ; if ( list . length < 0 ) { Logger . appendLog ( "[FilesUtils][I] deleting " + f . getAbsolutePath ( ) ) ; return f . delete ( ) ; } else { for ( File file : list ) { deleteRecursively ( file ) ; } return f . delete ( ) ; } } return done ; }
deletes recursively a folder ( use with care )
