open-vault/vendor/code.cloudfoundry.org/gofileutils/fileutils/dir_utils.go
2019-06-06 12:26:04 -07:00

21 lines
271 B
Go

package fileutils
import (
"os"
)
func IsDirEmpty(dir string) (isEmpty bool, err error) {
dirFile, err := os.Open(dir)
if err != nil {
return
}
_, readErr := dirFile.Readdirnames(1)
if readErr != nil {
isEmpty = true
} else {
isEmpty = false
}
return
}