【发布时间】:2014-08-06 15:14:41
【问题描述】:
我在尝试理解 filepath.Glob 时遇到了这个问题
for _, v := range ListofPaths{
exists, _ := filepath.Glob(fmt.Sprintf("%s/*/%s", v, filename))
}
适用于任何路径
ListofPathsPath/any/dot/thing/filename.ext
但不是
ListofPathsPath/filename.ext
所以从上面我需要匹配 glob %s/%s 或 %s/*/%s
有没有办法表达这个?我还没有完全掌握 filepath.Match 语法,也没有找到任何全面的示例。
【问题讨论】:
-
用
**代替*怎么样?