mirror of
https://github.com/vbatts/sl-feeds.git
synced 2024-11-25 17:05:39 +00:00
24 lines
397 B
Go
24 lines
397 B
Go
|
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
|
||
|
}
|