Created
June 28, 2018 02:24
-
-
Save locona/54c92b0a62470a5f46906ce4ab086e9b to your computer and use it in GitHub Desktop.
Golang get all files under the directory
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| func main() { | |
| searchDir := "./day=27" | |
| fileList := make([]string, 0) | |
| filepath.Walk(searchDir, func(path string, f os.FileInfo, err error) error { | |
| if f.IsDir() { | |
| return nil | |
| } | |
| fileList = append(fileList, path) | |
| return nil | |
| }) | |
| pp.Println(fileList) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment