code: private boolean delete(FTPClient client, Path file, boolean recursive)
        throws IOException {
      Path workDir = new Path(client.printWorkingDirectory());
      Path absolute = makeAbsolute(workDir, file);
      String pathName = absolute.toUri().getPath();
      FileStatus fileStat = getFileStatus(client, absolute);
      if (!fileStat.isDir()) {
        return client.deleteFile(pathName);
      }
      FileStatus[] dirEntries = listStatus(client, absolute);
      if (dirEntries != null && dirEntries.length > 0 && !(recursive)) {
        throw new IOException("Directory: " + file + " is not empty.");
      }
      if (dirEntries != null) {
        for (int i = 0; i < dirEntries.length; i++) {
          delete(client, new Path(absolute, dirEntries[i].getPath()), recursive);
        }
      }
      return client.removeDirectory(pathName);
    }
docs: Convenience method, so that we don't open a new connection when using this
  method from within another method. Otherwise every API invocation incurs
  the overhead of opening/closing a TCP connection.