It didn't like this :( It should list out all files from C:\ let root = "C:\\"; let getdirs dir = try System.IO.Directory.GetDirectories(dir) with | e -> Array.empty let rec list_files dir = seq { yield! System.IO.Directory.GetFiles(dir); for subdir in (getdirs dir) do match subdir with | x when x.StartsWith("C:\\$") -> () | subdir -> yield! list_files subdir } list_files root |> Seq.iter (printfn "%s") printf "done"…
Try F# in your browser
11–13 of 13 posts
Re: Try F# in your browser
#12It didn't like this :( It should list out all files from C:\ let root = "C:\\"; let getdirs dir = try System.IO.Directory.GetDirectories(dir) with | e -> Array.empty let rec list_files dir = seq { yield! System.IO.Directory.GetFiles(dir); for subdir in (getdirs dir) do match subdir with | x when x.StartsWith("C:\\$") -> () | subdir -> yield! list_files subdir } list_files root |> Seq.iter (printfn "%s") printf "done"…
Thanks for this - I'll take a look. The same code works fine when run through regular fsi.exe, so presumably something is going amiss over the Ajax interface.
I had to pad the first "let" to be at the same padding as the second one
Re: Try F# in your browser
#13Earlier quoted context omitted.
Thanks for this - I'll take a look. The same code works fine when run through regular fsi.exe, so presumably something is going amiss over the Ajax interface.
It works here, but lists certain files from the system, and stops at "Documents And Settings" - no rights etc. I had to pad the first "let" to be at the same padding as the second one