public static void getAllRetainedInDiff(String basePath, DirDiff dirDiff, Set<String> allRetained) {
    String prefix = basePath.isEmpty() ? basePath : basePath + "/";
    for (FileIndex fileRetained: dirDiff.getFilesRetained()) {
      allRetained.add(prefix + fileRetained.getFileName());
    }

    for (DirDiff dirRetained: dirDiff.getSubDirsRetained()) {
      getAllRetainedInDiff(prefix + dirRetained.getDirName(), dirRetained, allRetained);
    }
  }
Test util methods to work with local dirs, {@link DirDiff}s and {@link DirIndex}es.
samza-core/src/test/java/org/apache/samza/storage/blobstore/util/BlobStoreTestUtil.java