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)
}

 

文章来自:http://www.cnblogs.com/rojas/p/4398215.html
© 2021 jiaocheng.bubufx.com  联系我们
ICP备案:鲁ICP备09046678号-3