golang filepath.Walk遍历指定目录下的所有文件

package main



import (

    "fmt"

    "os"

    "path/filepath"

)



func walkFunc(path string, info os.FileInfo, err error) error {

    fmt.Printf("%s\n", path)

    return nil

}



func main() {

    //遍历打印所有的文件名

    filepath.Walk("C:/Documents and Settings/xxx/Desktop/Copy of change-sub", walkFunc)

}

 

你可能感兴趣的:(FilePath)