ruspa/dir_utils.go
2020-03-01 23:09:00 +01:00

29 lines
413 B
Go

package main
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
}