code: public static boolean deleteFileOrDirectory(File file) {
          if (file.exists() && file.isDirectory()) {
              File[] files = file.listFiles();
              if (files != null) {
                  for (File f : files) {
                      deleteFileOrDirectory(f);
                  }
              }
          }
  
          return file.delete();
      }
docs: Deletes the given file or directory. If a directory, recursively deletes all sub-directories and files.
  
  @param file The target to delete.
  @return True if the target was deleted, false otherwise.