Created
May 16, 2017 07:10
-
-
Save Ahmah2009/4afaa85e0ebb0fd769727fce53fc1a67 to your computer and use it in GitHub Desktop.
List all files located in dir
This file contains 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" | |
"io/ioutil" | |
"log" | |
) | |
func main() { | |
files, err := ioutil.ReadDir("path to dir") | |
if err != nil { | |
log.Fatal(err) | |
} | |
for _, file := range files { | |
fmt.Println(file.Name()) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment