36 lines
601 B
Go
36 lines
601 B
Go
package eliofile
|
|
|
|
import (
|
|
"log"
|
|
"os"
|
|
"strings"
|
|
)
|
|
|
|
type ElioHandleFunc func(filename string, csvfilemap *map[string]string) bool
|
|
|
|
type ElioDateiFoo struct {
|
|
process ElioHandleFunc
|
|
dir string
|
|
}
|
|
|
|
func NewElioDateiFoo(dir string, process ElioHandleFunc) *ElioDateiFoo {
|
|
df := ElioDateiFoo{dir: dir,
|
|
process: process,
|
|
}
|
|
return &df
|
|
}
|
|
|
|
func (f *ElioDateiFoo) ScanCsv(csvfilemap *map[string]string) {
|
|
files, err := os.ReadDir(f.dir)
|
|
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
|
|
for _, file := range files {
|
|
if strings.Contains(file.Name(), "csv") {
|
|
f.process(file.Name(), csvfilemap)
|
|
}
|
|
}
|
|
}
|