MCPcopy
hub / github.com/cubefs/cubefs / transferDirectoryToRemote

Function transferDirectoryToRemote

deploy/cmd/transform.go:30–47  ·  view source on GitHub ↗
(localFilePath string, remoteFilePath string, remoteUser string, remoteHost string)

Source from the content-addressed store, hash-verified

28}
29
30func transferDirectoryToRemote(localFilePath string, remoteFilePath string, remoteUser string, remoteHost string) error {
31 localFile, err := os.Open(localFilePath)
32 if err != nil {
33 return fmt.Errorf("failed to open local file: %s", err)
34 }
35 defer localFile.Close()
36
37 cmd := exec.Command("scp", "-r", localFilePath, remoteUser+"@"+remoteHost+":"+remoteFilePath)
38
39 err = cmd.Run()
40 if err != nil {
41 return fmt.Errorf("file %s transferred to %s@%s:%s failed", localFilePath, remoteUser, remoteHost, remoteFilePath)
42 }
43
44 log.Printf("file '%s' transferred to '%s@%s:%s' successfully.\n", localFilePath, remoteUser, remoteHost, remoteFilePath)
45
46 return nil
47}
48
49// TODO: to remove unused by golangci
50var _ = copyFolder

Callers 1

initClusterFunction · 0.85

Calls 5

OpenMethod · 0.65
ErrorfMethod · 0.65
CloseMethod · 0.65
RunMethod · 0.65
PrintfMethod · 0.65

Tested by

no test coverage detected