private Path createDirs(final Path dir, final List<String> pathElements) throws IOException {
        Path parentDir = dir;
        for (final String pathElement : pathElements) {
            final String safeName = ImportExportFileNameUtil.toSafeFileName(pathElement, 100);
            final Path child = parentDir.resolve(safeName);

            // If this folder hasn't been created yet then output data for the folder and create it.
            if (!Files.isDirectory(child)) {
                Files.createDirectories(child);
            }

            parentDir = child;
        }

        return parentDir;
    }
Prunes the node path for GitRepo exports. Removes everything in the rootPath
from the nodePath if the rootPath matches the start of the nodePath.
@param rootPath Can be null, in which case this function just returns nodePath.
                Otherwise, the list of items to prune from the start of nodePath.
@param nodePath The node path to prune.
@return The pruned nodePath.
stroom-importexport/stroom-importexport-impl/src/main/java/stroom/importexport/impl/ImportExportSerializerImpl.java