code: private boolean delete(String path, boolean recursive) throws IOException {
      IOException te = null;
      FileSystem hdfs = getFs();
      RetryPolicy retryPolicy = new CountingRetry(MAX_TRY);
      while (retryPolicy.attempt()) {
        try {
          return hdfs.delete(new Path(path), recursive);
        } catch (IOException e) {
          LOG.warn("Attempt count {} : {}", retryPolicy.getAttemptCount(), e.getMessage());
          te = e;
        }
      }
      throw te;
    }
docs: Delete a file or directory at path.
  
  @param path file or directory path
  @param recursive whether to delete path recursively
  @return true, if succeed