Skip to content

Instantly share code, notes, and snippets.

@Ahmah2009
Created May 16, 2017 07:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ahmah2009/4afaa85e0ebb0fd769727fce53fc1a67 to your computer and use it in GitHub Desktop.
Save Ahmah2009/4afaa85e0ebb0fd769727fce53fc1a67 to your computer and use it in GitHub Desktop.
List all files located in dir
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