Created
February 17, 2015 21:09
-
-
Save putridparrot/4163295c5f36ce9eca67 to your computer and use it in GitHub Desktop.
F# functions to get directories all directories within a given path
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
let rec getDirectories' (di: DirectoryInfo) = | |
seq { | |
yield di | |
for sd in di.GetDirectories() do | |
yield! getDirectories' sd | |
} | |
let getDirectories path = | |
let di = new DirectoryInfo(path) | |
if not di.Exists then | |
Seq.empty | |
else | |
getDirectories' di |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Simple snippet of F# code to get the directories for a given path