mirror of
https://github.com/MADTeacher/go_basics.git
synced 2025-11-23 21:34:47 +02:00
20 lines
375 B
Go
20 lines
375 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"log"
|
|
"os"
|
|
)
|
|
|
|
func main() {
|
|
fileInfo, err := os.Stat("test.txt")
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
fmt.Println("File name:", fileInfo.Name())
|
|
fmt.Println("Size in bytes:", fileInfo.Size())
|
|
fmt.Println("Permissions:", fileInfo.Mode())
|
|
fmt.Println("Last modified:", fileInfo.ModTime())
|
|
fmt.Println("Is Directory: ", fileInfo.IsDir())
|
|
}
|