Skip to content

Instantly share code, notes, and snippets.

@shazadbrohi
Last active January 30, 2021 23:09
Show Gist options
  • Save shazadbrohi/ba15d291dfbeaca9f5b65770c6dde6fa to your computer and use it in GitHub Desktop.
Save shazadbrohi/ba15d291dfbeaca9f5b65770c6dde6fa to your computer and use it in GitHub Desktop.
ls.go
package main
import (
"fmt"
"io/ioutil"
)
func main(){
fmt.Println("Reading contents of current directory: ")
files, err := ioutil.ReadDir(".")
if err != nil {
panic(err)
}
for _, file := range files {
fmt.Printf("Name: %s, Size: %d, Last Modified Time: %s\n", file.Name(), file.Size(), file.ModTime().String())
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment