23 lines
503 B
Go
23 lines
503 B
Go
package file
|
|
|
|
import (
|
|
"fmt"
|
|
"os/exec"
|
|
|
|
"ems.agt/lib/core/conf"
|
|
)
|
|
|
|
// 网元NE 文件复制到远程文件夹
|
|
func FileNeSCP(neIp, filePath, dstPath string) error {
|
|
usernameNe := conf.Get("ne.user").(string)
|
|
// scp /path/to/local/file.txt user@remote-server:/path/to/remote/directory/
|
|
dstDir := fmt.Sprintf("%s@%s:%s", usernameNe, neIp, dstPath)
|
|
cmd := exec.Command("scp", "-r", filePath, dstDir)
|
|
out, err := cmd.CombinedOutput()
|
|
if err != nil {
|
|
return err
|
|
}
|
|
fmt.Println(out)
|
|
return nil
|
|
}
|