Created
December 2, 2015 15:15
-
-
Save Fabszn/0fca4890ecf8894a2c5a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object Main extends App { | |
import java.io.File | |
implicit def convert(l: List[File]): Array[File] = l.toArray | |
def print(f: File): Option[String] = { | |
val name = f.getName | |
if (!f.isDirectory && name.startsWith("Test")) { | |
Some(name) | |
} else { | |
None | |
} | |
} | |
def scanDirectory(dir: Option[Array[File]]): Unit = { | |
dir.getOrElse(Array[File]()).toList match { | |
case h :: tail => { | |
print(h).map(println).getOrElse({scanDirectory(Option(h.listFiles)) }) | |
scanDirectory(Option(tail)) | |
} | |
case Nil => | |
case _ => | |
} | |
} | |
val dir = new File("C:/dev/projects/workspace_git/lu_p1/LU_IntegrationTests/src/test/java/org/erdf/amm/lu/test") | |
scanDirectory(Option(dir.listFiles())) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment