package file import ( "fmt" "os/exec" "ems.agt/lib/core/conf" "ems.agt/lib/log" ) // 网元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 } log.Infof("FileNeSCP %s", string(out)) return nil }