private static DirDiff getDiffForNewDir(File localSubDir) {
    List<File> filesAdded = new ArrayList<>();
    List<DirDiff> subDirsAdded = new ArrayList<>();

    File[] files = localSubDir.listFiles();
    if (files != null) {
      for (File file: files) {
        if (file.isFile()) {
          LOG.debug("Adding file {} to local sub dir {}", file.getName(), localSubDir.getPath());
          filesAdded.add(file);
        } else {
          LOG.debug("Adding sub dir {} to sub dir {}", file.getName(), localSubDir.getPath());
          subDirsAdded.add(getDiffForNewDir(file));
        }
      }
    }

    return new DirDiff(localSubDir.getName(), filesAdded, Collections.emptyList(), Collections.emptyList(),
        subDirsAdded, Collections.emptyList(), Collections.emptyList());
  }
Builds a {@link DirDiff} from a new local directory that is not already present in the remote snapshot.
@param localSubDir File representing the local directory to create the new {@link DirDiff} for.
samza-core/src/main/java/org/apache/samza/storage/blobstore/util/DirDiffUtil.java