2020-03-05 14:32:50 +01:00
|
|
|
package tree
|
2020-03-01 23:09:00 +01:00
|
|
|
|
|
|
|
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
|
|
|
|
}
|