Search code examples
powershellf#globuncf#-fake

Why does Fake / F# globbing not work on UNC paths


I have a small test script reproducing the problem

// include Fake lib
#r @"tools\FAKE\tools\FakeLib.dll"
open Fake 

let root = @"\\wgprintsrv\FTP\FTPSoftware\FTPSW\weincad\release"

let glob = root @@ "**\*.dll"

trace glob

!! glob
|> Seq.iter (fun file -> trace file )

it lists nothing. Just to check the following powershell command

ls -R \\wgprintsrv\FTP\FTPSoftware\FTPSW\weincad\release -Filter *.dll

generates everything I expect. If I replace the UNC path with a local relative path then everything works. Is this possible to work around or is it a core problem with UNC paths and F# globbing?


Solution

  • Not too user friendly but the glob doesn't recognize absolute paths. You have to set the base directory like so

    // include Fake lib
    #r @"tools\FAKE\tools\FakeLib.dll"
    open Fake 
    
    let root = @"\\wgprintsrv\FTP\FTPSoftware\FTPSW\weincad\release"
    
    let glob = "**\*.dll"
    
    trace glob
    
    !! glob
    |> SetBaseDir root
    |> Seq.iter (fun file -> trace file )