decentral1se
3 years ago
4 changed files with 32 additions and 0 deletions
@ -0,0 +1,7 @@ |
|||
# exp |
|||
|
|||
> WIP |
|||
|
|||
## `ls.go` |
|||
|
|||
Lists files in [`files`](./files/). Run with `go run ls.go`. |
Binary file not shown.
Binary file not shown.
@ -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…
Reference in new issue