mcadump现在支持通配符匹配文件以及路径了

This commit is contained in:
Tnze
2019-08-07 21:58:54 +08:00
parent 92f786dfe0
commit bf46650ffc

View File

@ -32,25 +32,15 @@ func main() {
f, o = args[0], args[1] f, o = args[0], args[1]
} }
dirName := filepath.Dir(f) fs, err := filepath.Glob(f)
patName := filepath.Base(f)
dir, err := os.Open(dirName)
checkerr(err) checkerr(err)
fs, err := dir.Readdirnames(0)
checkerr(err)
for _, f := range fs {
ok, err := filepath.Match(patName, f)
checkerr(err)
if !ok {
continue
}
if *repack { if *repack {
for _, f := range fs {
pack(f, o) pack(f, o)
}
} else { } else {
for _, f := range fs {
unpack(f, o) unpack(f, o)
} }
} }