Created
February 4, 2020 12:06
-
-
Save bbg/247fbec834acd5e933ccdbd27079deaa to your computer and use it in GitHub Desktop.
file listing in folder
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 | |
| import ( | |
| "fmt" | |
| "os" | |
| "path/filepath" | |
| ) | |
| func main() { | |
| var files []string | |
| root := "/home/puncrash/@Workspace/github.com/gustavocd/file-upload-ajax" | |
| err := filepath.Walk(root, func(path string, info os.FileInfo, err error) error { | |
| files = append(files, path) | |
| return nil | |
| }) | |
| if err != nil { | |
| panic(err) | |
| } | |
| for _, file := range files { | |
| fmt.Println(file) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment