public static Path createLocalDir(String files) throws IOException {
    Path tempDirPath = Files.createTempDirectory(TEMP_DIR_PREFIX);
    File tempDirFile = tempDirPath.toFile();
    String tempDirPathString = tempDirPath.toAbsolutePath().toString();

    if (files.length() == 2) return tempDirPath;
    String[] paths = files.substring(1, files.length() - 1).split(",");

    for (String path: paths) {
      path = path.trim();
      if (!path.contains("/")) {
        Path filePath = Files.createFile(Paths.get(tempDirPathString, path));
        new FileUtil().writeToTextFile(filePath.toFile(), path, false); // file contents == file name
        filePath.toFile().deleteOnExit();
      } else {
        String dirs = path.substring(0, path.lastIndexOf("/"));
        String file = path.substring(path.lastIndexOf("/") + 1);
        Path directories = Files.createDirectories(Paths.get(tempDirPathString, dirs));
        if (!StringUtils.isBlank(file)) { // can be blank for empty directories
          Path filePath = Paths.get(directories.toAbsolutePath().toString(), file);
          Files.createFile(filePath);
          new FileUtil().writeToTextFile(filePath.toFile(), file, false); // file contents == file name
          filePath.toFile().deleteOnExit();
        }
      }
    }

    deleteDirRecursivelyOnExit(tempDirFile);
    return tempDirPath;
  }
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