Add exclude mode

This commit is contained in:
r0n1n7an 2023-07-31 08:39:12 +08:00
parent a44c85eb32
commit c5b9e86374
2 changed files with 21 additions and 9 deletions

Binary file not shown.

View File

@ -18,12 +18,13 @@ type FileInfo struct {
}
var (
dbg bool = false
exclude bool = false
aodType string = ""
aodPath string = ""
modPath string = ""
aodInfoList []FileInfo
moduleInfoList []FileInfo
aodList = make([]string, 0)
criList = make([]string, 0)
moduleList = make([]string, 0)
distinctCriList = make([]string, 0)
@ -40,8 +41,8 @@ var regTNB = `(?i)SSW\S{7}\.SSW\S{7}`
var regSBID = `(?i)\S{8,}\.DAT`
func init() {
flag.BoolVar(&dbg, "v", false, "Show Verbose Debug Messages")
flag.StringVar(&aodPath, "a", `D:\MfgTest\PRELOAD\AOD`, "Path Of AODs")
flag.BoolVar(&exclude, "x", false, "Exclude Mode")
flag.StringVar(&aodPath, "a", `D:\Vol1\PDLINE\PLANT1\PRELOAD\AOD`, "Path Of AODs")
flag.StringVar(&modPath, "m", `D:\Common`, "Path Of Modules")
flag.StringVar(&aodType, "t", "*", "Type Of AODs, LNB/TNB/SBID/*")
flag.Parse()
@ -82,6 +83,7 @@ func main() {
}
log.Printf("[MSG] Summary CRIs From AODs ...\r\n")
for _, aod := range aodInfoList {
aodList = append(aodList, aod.FilePath)
rdr, err := os.Open(aod.FilePath)
if err != nil {
errAOD = append(errAOD, aod.FilePath)
@ -157,6 +159,8 @@ func main() {
}
}
_WriteFileFromStringSlice(".\\AOD.txt", aodList)
log.Printf("***** Error AODs: %d\r\n", len(errAOD))
_WriteFileFromStringSlice(".\\errAOD.txt", errAOD)
@ -182,9 +186,10 @@ func _SummaryAOD(basePath, filter string) ([]FileInfo, error) {
fileInfo.FilePath = path
fileInfo.FileSize = info.Size()
//fileInfo.ModTime = info.ModTime().Format("2006-01-02 15:04:05")
if !strings.Contains(fileInfo.FilePath, ".svn") {
fileInfoList = append(fileInfoList, fileInfo)
}
// if !strings.Contains(fileInfo.FilePath, ".svn") {
// fileInfoList = append(fileInfoList, fileInfo)
// }
fileInfoList = append(fileInfoList, fileInfo)
}
return nil
})
@ -207,10 +212,17 @@ func _SummaryAOD(basePath, filter string) ([]FileInfo, error) {
for _, i := range fileInfoList {
reg := regexp.MustCompile(regFilter)
rst := reg.FindStringSubmatch(i.FileName)
if len(rst) != 1 {
continue
if exclude {
if len(rst) == 1 {
continue
}
sortInfoList = append(sortInfoList, i)
} else {
if len(rst) != 1 {
continue
}
sortInfoList = append(sortInfoList, i)
}
sortInfoList = append(sortInfoList, i)
}
return sortInfoList, nil
}