eliotools/eliofile/eliofile.go

41 lines
523 B
Go

package eliofile
import (
"fmt"
"log"
"os"
"strings"
)
type ElioDateiFoo struct {
process func(file string)
}
func NewElioDateiFoo() *ElioDateiFoo {
df := ElioDateiFoo{
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())
}
}
}
func main() {
df := NewElioDateiFoo()
df.scanCsv()
}