Skip to content

Instantly share code, notes, and snippets.

Last active December 3, 2017 21:23
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save jon49/0940bcba98c4dce8da7a89cc66dd52a4 to your computer and use it in GitHub Desktop.
See the earliest F# file you have written
open System.IO
let sourceDir = [ __SOURCE_DIRECTORY__ ]
let getFiles searchPattern dir =
seq {
yield! Directory.EnumerateFiles(dir, searchPattern)
let log x =
printfn "%A" x
let rec getAllFiles f dirs =
if Seq.isEmpty dirs then Seq.empty else
seq { yield! dirs |> Seq.collect f
yield! dirs
|> Seq.collect Directory.EnumerateDirectories
|> Seq.filter (fun x ->
let dirName = Path.GetFileName x
[ "node_modules"; ".git"; "bin"; "obj"; "vendors"; "themes"; "packages"; "VisualStudio2010" ]
|> List.contains dirName
|> not )
|> fun x -> if Seq.isEmpty x then Seq.empty else (getAllFiles f x) }
let getFileDates () =
let FSharp = getFiles "*.fs?"
getAllFiles FSharp sourceDir
|> (fun x ->
let creationTime = File.GetLastWriteTime x
x, creationTime
|> Seq.toArray
getFileDates ()
|> Seq.minBy ( fun (filename, date) -> date )
|> (printfn "%A")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment