Last active
January 30, 2021 23:09
-
-
Save shazadbrohi/ba15d291dfbeaca9f5b65770c6dde6fa to your computer and use it in GitHub Desktop.
ls.go
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" | |
"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