ssh/example/upload/main.go

23 lines
495 B
Go
Raw Normal View History

2018-10-30 17:45:30 +08:00
package main
import (
"blacktea.vip.cpolar.top/OrgGo/ssh"
2018-10-30 17:45:30 +08:00
)
func main() {
2018-11-13 17:42:29 +08:00
client, err := ssh.NewClient("localhost", "22", "root", "ubuntu")
2018-10-30 17:45:30 +08:00
if err != nil {
panic(err)
}
defer client.Close()
var remotedir = "/root/test/"
// upload dir
var local = "/home/ubuntu/go/src/blacktea.vip.cpolar.top/OrgGo/ssh/test/upload/"
2018-10-30 17:45:30 +08:00
client.Upload(local, remotedir)
// upload file
local = "/home/ubuntu/go/src/blacktea.vip.cpolar.top/OrgGo/ssh/test/upload/file"
2018-10-30 17:45:30 +08:00
client.Upload(local, remotedir)
}