package main import ( "fmt" "os" "path/filepath" ) func walkFunc(path string, info os.FileInfo, err error) error { fmt.Printf("%s ", path) return nil } func main() { //遍历打印所有的文件名 filepath.Walk("C:/Documents and Settings/xxx/Desktop/Copy of change-sub", walkFunc) }