ruspa/tree/dir_utils.go

29 righe
413 B
Go

package tree
import (
"os"
)
func ListDir(path string) ([]os.FileInfo, error) {
var files []os.FileInfo
f, err := os.Open(path)
if err != nil {
return files, err
}
defer f.Close()
return f.Readdir(-1)
}
func AnyDirectoryDownThere(path string) bool {
files, err := ListDir(path)
if err != nil {
panic(err)
}
for _, file := range files {
if file.IsDir() {
return true
}
}
return false
}