If you ever need to generate a list of subdirectories in a directory in Scala, here's one way to do it:
def getListOfSubDirectories(directoryName: String): Array[String] = {
return (new File(directoryName)).listFiles.filter(_.isDirectory).map(_.getName)
}
I intentionally wrote that function in a short, "Scala like" style, but you can expand it to multiple lines, if you prefer.
To demonstrate the use of this directory-listing function, you can print all your subdirectories like this: