Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- func exploreDirectory (string path) ([]string, error){
- var output []string
- //Get entries
- info, err := ioutil.ReadDir(path)
- if err != nil {
- return nil, err
- }
- for i, _ := range info {
- if !info[i].IsDir() {
- //Output file
- output := append(output, path + "/" + info[i].Name)
- } else {
- //Explore it; it's a directory.
- entries, err := exploreDirectory(path + "/" + info[i].Name())
- if err != nil {
- return nil, err
- }
- output := append(output, entries...)
- }
- }
- return output, nil
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement