private static void updateStatsForDirRemoved(DirIndex dirIndex, Stats stats) {
    // every file and sub-dir present in a removed parent dir are to be removed as well
    // files and sub-dirs to be removed don't matter since they would have already been
    // cleaned up after the previous commit
    stats.filesRemoved += dirIndex.getFilesRemoved().size();
    stats.bytesRemoved += dirIndex.getFilesPresent().stream().mapToLong(f -> f.getFileMetadata().getSize()).sum();
    for (DirIndex subDirRemoved: dirIndex.getSubDirsPresent()) {
      stats.subDirsRemoved += 1;
      updateStatsForDirRemoved(subDirRemoved, stats);
    }
  }
Subdirectories that are already present in the previous snapshot, but don't exist in the local snapshot,
and hence all of their contents need to be recursively removed.
samza-core/src/main/java/org/apache/samza/storage/blobstore/diff/DirDiff.java