1、实现压缩包的Markdown文件导入

2、重命名文件
This commit is contained in:
Minho
2018-03-24 22:36:35 +08:00
parent 4d1a03998a
commit 3c87a12bdd
15 changed files with 187 additions and 92 deletions

View File

@@ -198,4 +198,24 @@ func Round(val float64, places int) float64 {
}
return t
}
//判断指定目录下是否存在指定后缀的文件
func HasFileOfExt(path string,exts []string) bool {
err := filepath.Walk(path, func(path string, info os.FileInfo, err error) error {
if !info.IsDir() {
ext := filepath.Ext(info.Name())
for _,item := range exts {
if strings.EqualFold(ext,item) {
return os.ErrExist
}
}
}
return nil
})
return err == os.ErrExist
}