读取CSV文件,转换map数据。文件上传scp
This commit is contained in:
22
lib/core/file/ssh.go
Normal file
22
lib/core/file/ssh.go
Normal file
@@ -0,0 +1,22 @@
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user