|
@@ -2,7 +2,6 @@ package main
|
|
|
|
|
|
import (
|
|
|
"fmt"
|
|
|
- "os"
|
|
|
"time"
|
|
|
|
|
|
"git.wecise.com/wecise/cgimport/cgf"
|
|
@@ -25,17 +24,15 @@ func main() {
|
|
|
datapath := mcfg.GetString("datapath", "data")
|
|
|
// 并发数
|
|
|
parallel := mcfg.GetInt("parallel", 10)
|
|
|
- // 检查参数,文件目录
|
|
|
- f, _ := os.Stat(datapath)
|
|
|
- if f == nil {
|
|
|
- fmt.Println(`put all data files in directory "` + datapath + `"`)
|
|
|
- return
|
|
|
- }
|
|
|
// 导入
|
|
|
filescount, recordscount, e := cgf.ImportDir(datapath, parallel)
|
|
|
if e != nil {
|
|
|
panic(e)
|
|
|
}
|
|
|
+ if filescount == 0 {
|
|
|
+ fmt.Println(`not found data files in "` + datapath + `"`)
|
|
|
+ return
|
|
|
+ }
|
|
|
// 输出统计信息
|
|
|
fmt.Println("total import", filescount, "files", recordscount, "records", "in", time.Since(st))
|
|
|
}
|