Skip to content

Instantly share code, notes, and snippets.

@dgfitch
Created August 17, 2010 15:06
Show Gist options
  • Save dgfitch/530297 to your computer and use it in GitHub Desktop.
Save dgfitch/530297 to your computer and use it in GitHub Desktop.
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