1
0
Fork 0
mirror of https://github.com/vbatts/sl-feeds.git synced 2024-11-25 17:05:39 +00:00
sl-feeds/util/find.go

24 lines
397 B
Go
Raw Normal View History

package util
import (
"os"
"path/filepath"
)
func FindFiles(root, name string) (paths []string, err error) {
paths = []string{}
err = filepath.Walk(root, func(path string, info os.FileInfo, err error) error {
if err != nil {
return err
}
if filepath.Base(path) == name {
paths = append(paths, path)
}
return nil
})
if err != nil {
return nil, err
}
return paths, nil
}