Created
August 17, 2010 15:06
-
-
Save dgfitch/530297 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
open System.IO | |
type Walker(p) = | |
let root = new DirectoryInfo(p) | |
let root_path = root.FullName | |
let link (f:FileInfo) = | |
let relative_path = f.FullName.Replace(root_path, "").TrimStart('\\') | |
printfn "<p><a href='%s'>%s</a></p>" relative_path f.Name | |
let rec walk path = | |
let dir = new DirectoryInfo(path) | |
dir.GetDirectories() |> Seq.iter (fun d -> walk d.FullName) | |
dir.GetFiles() |> Seq.iter link | |
member this.Execute() = walk root_path | |
static member Dump path = | |
(new Walker(path)).Execute() | |
Walker.Dump fsi.CommandLineArgs.[1] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment