code: static public void recursiveDeleteDirectory(FTPClient ftpClient, String path) throws IOException {
  
          logger.info("Delete directory: {}", path);
  
          FTPFile[] ftpFiles = ftpClient.listFiles(path);
          logger.debug("Number of files that will be deleted: {}", ftpFiles.length);
  
          for (FTPFile ftpFile : ftpFiles){
              String filename = path + "/" + ftpFile.getName();
              if (ftpFile.getType() == FTPFile.FILE_TYPE) {
                  boolean deleted = ftpClient.deleteFile(filename);
                  logger.debug("Deleted {}? {}", filename, deleted);
              } else {
                  recursiveDeleteDirectory(ftpClient, filename);
              }
          }
  
          boolean dirDeleted = ftpClient.deleteFile(path);
          logger.debug("Directory {} deleted: {}", path, dirDeleted);
      }
docs: Deletes a directory with all its files and sub-directories.
  
  @param ftpClient
  @param path
  @throws IOException