Skip to content

Instantly share code, notes, and snippets.

@locona
Created June 28, 2018 02:24
Show Gist options
  • Select an option

  • Save locona/54c92b0a62470a5f46906ce4ab086e9b to your computer and use it in GitHub Desktop.

Select an option

Save locona/54c92b0a62470a5f46906ce4ab086e9b to your computer and use it in GitHub Desktop.
Golang get all files under the directory
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