I have the following code which works fine under Linux/Unix:
Files.walk(Paths.get(getStartingPath()))
.filter(Files::isDirectory)
// Skip directories which start with a dot (like, for example: .index)
.filter(path -> !path.toAbsolutePath().toString().matches(".*/\\..*"))
// Note: Sorting can be expensive:
.sorted()
.forEach(operation::execute);
However, under Windows, this part seems to not work properly:
.filter(path -> !path.toAbsolutePath().toString().matches(".*/\\..*"))
What would be the proper way to make this OS-independent?