实例:
package main
import (
"fmt"
"io/ioutil"
)
func main() {
dirname := "/root/test"
dir, _ := ioutil.ReadDir(dirname)
if len(dir) == 0 {
fmt.Println(dirname + " is empty dir!")
} else {
fmt.Println(dirname + " is not empty dir!")
}
}