36 lines
524 B
Go
36 lines
524 B
Go
package eliofile
|
|
|
|
import (
|
|
"log"
|
|
"os"
|
|
"strings"
|
|
)
|
|
|
|
type ElioHandleFunc func(filename string)
|
|
|
|
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() {
|
|
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())
|
|
}
|
|
}
|
|
}
|