public static boolean deleteDir(File path) {
    if( path.exists() ) {
      File[] files = path.listFiles();
      for(int i=0; i<files.length; i++) {
         if(files[i].isDirectory()) {
           deleteDir(files[i]);
         }
         else {
           files[i].delete();
         }
      }
    }
    boolean ok = path.delete();
    if (!ok) System.err.println("[WARN] Unable to delete: "+path);
    return ok;
  }