public static boolean isValidLeafPath(final Path path) {
        if (path == null) {
            return false;
        } else {
            final int nameCount = path.getNameCount();
            final int lastNameIdx = nameCount - 1;
            final String leafPart = path.getName(lastNameIdx).toString();
            final int leafLen = leafPart.length();
            LOGGER.trace("path: {}, nameCount: {}, lastNameIdx: {}, leafPart: {}, leafLen: {}",
                    path, nameCount, lastNameIdx, leafPart, leafLen);
            if (!isValidLeafPart(leafPart)) {
                LOGGER.trace("Invalid leafPart: {}", leafPart);
                return false;
            } else {
                final Path expectedPath = createPath(Path.of(""), leafPart);
                if (!path.endsWith(expectedPath)) {
                    LOGGER.trace("path {} doesn't end with expectedPath {}", path, expectedPath);
                    return false;
                } else {
                    return true;
                }
            }
        }
    }
Paths should look something like this '....../2/333/555/333555777', where '2' is the depth

@return True if the path conforms to the expected dir structure.
stroom-proxy/stroom-proxy-app/src/main/java/stroom/proxy/app/handler/DirUtil.java