public CompletionStage<Void> deleteDir(DirIndex dirIndex, Metadata metadata) {
    LOG.debug("Completely deleting dir: {} in blob store", dirIndex.getDirName());
    List<CompletionStage<Void>> deleteFutures = new ArrayList<>();
    // Delete all files present in subDir
    for (FileIndex file: dirIndex.getFilesPresent()) {
      Metadata requestMetadata =
          new Metadata(file.getFileName(), Optional.of(file.getFileMetadata().getSize()),
              metadata.getJobName(), metadata.getJobId(), metadata.getTaskName(), metadata.getStoreName());
      deleteFutures.add(deleteFile(file, requestMetadata));
    }

    // Delete all subDirs present recursively
    for (DirIndex subDir: dirIndex.getSubDirsPresent()) {
      deleteFutures.add(deleteDir(subDir, metadata));
    }

    return CompletableFuture.allOf(deleteFutures.toArray(new CompletableFuture[0]));
  }
WARNING: Recursively delete **ALL** the associated files and subdirs within the provided {@link DirIndex}.
@param dirIndex {@link DirIndex} whose entire contents are to be deleted.
@param metadata {@link Metadata} related to the request
@return a future that completes when ALL the files and subdirs associated with the dirIndex have been
marked for deleted in the remote blob store.
samza-core/src/main/java/org/apache/samza/storage/blobstore/util/BlobStoreUtil.java