Go

No description

fork
loading
Files
  • main.go
  • Setup.bash
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package main

import (
	"fmt"

	"github.com/secsy/goftp"
)

func main() {
	config := goftp.Config{
		ConnectionsPerHost: 10,
	}

	client, err2 := goftp.DialConfig(config, "ftp.cs.brown.edu")

	if err2 != nil {
		fmt.Println("error on connect", err2)
	} else {
		fmt.Println("Connect")
	}

	path, err := client.Getwd()
	if err != nil {
		fmt.Println("error on PWD", err)
	} else {
		fmt.Println("got PWD")
	}

	files4, err4 := client.ReadDir(path)
	if err4 != nil {
		fmt.Println("error on read %s", err4)
	} else {
		for _, element := range files4 {
			fmt.Printf("%s: %t\n", element.Name(), element.IsDir())
		}
	}

}