Random changes for an old tool.
This commit is contained in:
parent
69eb9d09ec
commit
3b5be0e6d8
@ -38,36 +38,7 @@ func load(dbPath, mdPath string) error {
|
||||
skipPats := strings.Split(*skipFiles, ",")
|
||||
glog.Infoln("Skip files", skipPats)
|
||||
imported, count := 0, 0
|
||||
if err := filepath.Walk(mdPath, func(path string, info os.FileInfo, err error) error {
|
||||
base := filepath.Base(path)
|
||||
if info.IsDir() {
|
||||
glog.Infoln(path)
|
||||
for _, pat := range skipPats {
|
||||
ok, err := filepath.Match(pat, base)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if ok {
|
||||
return filepath.SkipDir
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if !info.Mode().IsRegular() {
|
||||
return nil
|
||||
}
|
||||
for _, pat := range skipPats {
|
||||
ok, err := filepath.Match(pat, base)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if ok {
|
||||
return nil
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if err := maildir.Walk(mdPath, func(path string) error {
|
||||
r, err := os.Open(path)
|
||||
if err != nil {
|
||||
return fmt.Errorf("%q open: %v", path, err)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user