Add skip specified modules function
This commit is contained in:
parent
43451201b5
commit
20d8951b21
Binary file not shown.
@ -26,17 +26,19 @@ var (
|
||||
aodType string = ""
|
||||
aodPath string = ""
|
||||
modPath string = ""
|
||||
skipFile string = ""
|
||||
aodList = make([]string, 0)
|
||||
criList = make([]string, 0)
|
||||
moduleList = make([]string, 0)
|
||||
skipList = make([]string, 0)
|
||||
uniqueCriList = make([]string, 0)
|
||||
uniqueModuleList = make([]string, 0)
|
||||
needlessModuleList = make([]string, 0)
|
||||
missingModuleList = make([]string, 0)
|
||||
errAOD = make([]string, 0)
|
||||
errCRI = make([]string, 0)
|
||||
aodInfoList []FileInfo
|
||||
moduleInfoList []FileInfo
|
||||
aodList = make([]string, 0)
|
||||
criList = make([]string, 0)
|
||||
moduleList = make([]string, 0)
|
||||
uniqueCriList = make([]string, 0)
|
||||
uniqueModuleList = make([]string, 0)
|
||||
needlessModuleList = make([]string, 0)
|
||||
missingModuleList = make([]string, 0)
|
||||
errAOD = make([]string, 0)
|
||||
errCRI = make([]string, 0)
|
||||
)
|
||||
|
||||
var regFilter = `.*`
|
||||
@ -52,6 +54,7 @@ func init() {
|
||||
flag.StringVar(&modPath, "m", `D:\COMMON`, "Path Of Modules")
|
||||
flag.StringVar(&bkupPath, "b", `D:\COMMON_BKUP`, "Path Of Backup")
|
||||
flag.StringVar(&aodType, "t", "*", "Type Of AODs, LNB/TNB/SBID/*")
|
||||
flag.StringVar(&skipFile, "s", "./SkipList.txt", "Text File Of Skip Modules")
|
||||
flag.Parse()
|
||||
}
|
||||
|
||||
@ -69,6 +72,19 @@ func main() {
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
if skipFile != "" {
|
||||
obj, err := os.Open(skipFile)
|
||||
if err == nil {
|
||||
buf := bufio.NewScanner(obj)
|
||||
for buf.Scan() {
|
||||
if buf.Err() != nil {
|
||||
break
|
||||
}
|
||||
skipList = append(skipList, strings.TrimSpace(buf.Text()))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
log.Printf("[MSG] Summary Loacal AODs ...\r\n")
|
||||
aodInfoList, err = _SummaryAODs(aodPath, aodType)
|
||||
if err != nil {
|
||||
@ -97,6 +113,7 @@ func main() {
|
||||
rdr, err := os.Open(aod)
|
||||
if err != nil {
|
||||
errAOD = append(errAOD, aod)
|
||||
continue
|
||||
}
|
||||
buf := bufio.NewScanner(rdr)
|
||||
for buf.Scan() {
|
||||
@ -193,7 +210,14 @@ func main() {
|
||||
}
|
||||
}
|
||||
ttl := 0
|
||||
LOOP:
|
||||
for _, n := range needlessModuleList {
|
||||
for _, s := range skipList {
|
||||
if s == n {
|
||||
log.Printf("[MSG] Skip Backup Module: %s\r\n", s)
|
||||
continue LOOP
|
||||
}
|
||||
}
|
||||
for _, m := range moduleInfoList {
|
||||
if m.FileName == n {
|
||||
if m.FileTime.AddDate(diffYear, 0, 0).Before(time.Now()) {
|
||||
@ -209,7 +233,7 @@ func main() {
|
||||
}
|
||||
}
|
||||
}
|
||||
log.Printf("[MSG] Total Backup Modules: %d\r\n", ttl)
|
||||
log.Printf("[MSG] Total Backed Up Modules: %d\r\n", ttl)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user