eliotools/eliofile/eliofile.go

37 lines
502 B
Go

package eliofile
import (
"fmt"
"log"
"os"
"strings"
)
type ElioDateiFoo struct {
process func(file string)
dir string
}
func NewElioDateiFoo(dir string) *ElioDateiFoo {
df := ElioDateiFoo{dir: dir,
process: func(file string) {
fmt.Println(file)
},
}
return &df
}
func (f *ElioDateiFoo) ScanCsv() {
files, err := os.ReadDir(".")
if err != nil {
log.Fatal(err)
}
for _, file := range files {
if strings.Contains(file.Name(), "csv") {
f.process(file.Name())
}
}
}