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

 

posted on 2015-04-07 14:14  rojas  阅读(7287)  评论(0编辑  收藏  举报