Browse Source

example ls program

main
decentral1se 2 years ago
parent
commit
daac17e453
No known key found for this signature in database GPG Key ID: 3789458B3D0C410
  1. 7
      exp/README.md
  2. BIN
      exp/files/arrestantenhandleiding.pdf
  3. BIN
      exp/files/vanwiehuurik.pdf
  4. 25
      exp/ls.go

7
exp/README.md

@ -0,0 +1,7 @@
# exp
> WIP
## `ls.go`
Lists files in [`files`](./files/). Run with `go run ls.go`.

BIN
exp/files/arrestantenhandleiding.pdf

Binary file not shown.

BIN
exp/files/vanwiehuurik.pdf

Binary file not shown.

25
exp/ls.go

@ -0,0 +1,25 @@
package main
import (
"fmt"
"io/ioutil"
"log"
"path/filepath"
)
func main() {
fpath, err := filepath.Abs("./files")
if err != nil {
log.Fatalln(err)
}
files, err := ioutil.ReadDir(fpath)
if err != nil {
log.Fatalln(err)
}
for _, file := range files {
fmt.Println(file.Name())
}
}
Loading…
Cancel
Save