code: public static boolean tryDeleteFileOrDirectory(File file) {
      try {
        deleteFileOrDirectory(file);
        return true;
      } catch (Exception e) {
        logger.warn("Failed to delete file. file = " + file.getAbsolutePath(), e);
        return false;
      }
    }
docs: Try to delete File or Directory
  
  @param file file object
  @return success delete or not