powershell - 为什么 Fake/F# 通配在 UNC 路径上不起作用

标签 powershell f# glob unc f#-fake

我有一个重现问题的小测试脚本

// 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 )

它什么也没列出。只是为了检查以下 powershell 命令

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

生成我期望的一切。如果我用本地相对路径替换 UNC 路径,那么一切正常。这是否可以变通,或者这是 UNC 路径和 F# 通配的核心问题?

最佳答案

不太用户友好,但 glob 无法识别绝对路径。你必须像这样设置基本目录

// 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 )

关于powershell - 为什么 Fake/F# 通配在 UNC 路径上不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24627470/

相关文章:

powershell - 根据用户名输入变量断开RDS用户

arrays - Powershell阵列:何时使用它们;什么时候避免他们和使用它们的问题

f# - 内置 f# 运算符来组合具有相同输入但不同输出的函数?

command-line - zsh 究竟是如何扩展 globs 的?

c - 单元测试 zsh extendedglob 功能

regex - 命令行提取文件中引用的所有域名

powershell - 另一个具有相同属性identifierUris值的对象已存在

F# 匹配两个值

f# - 计算表达式中的类型推断错误

python - 带有 if 语句的 glob 来选择要将哪些文件存储到变量?