Nir
08/21/2020, 10:35 PM//Object a matcher object from the supplied Glob pattern
val matcher = FileSystems.getDefault().getPathMatcher(glob)
val path = Paths.get(start)
//Walk the file system
Files.walk(path)
//Filter out anything that doesn't match the glob
.filter { it : Path? -> it?.let { matcher.matches(it.fileName) } ?: false }
//Collect to a list
.collect(toList())
Not only is this code ugly, but it also seems incredibly inefficient to walk every file and filter, compared to how globs can actually be done. I don't have much faith in this snippet anyhow because there's some oddities but it's the best I'd found.