From my bash shell, I am able to run this following command successfully - scp <local-folder>/* <user>@<remote-host>:/var/tmp
. All files in my <local-folder>
are copied onto the remote location.
Now I am trying to run the above same command from my Go program, with exec.Command()
but scp
complains of "no such file / directory - <local-folder>/*
' - the '*' is literally taken as a filename. I want to replicate the same behaviour of scp
I get when I run it from my Bash shell. Here is the code snippet I am using:
pushCmd := exec.Command("scp", "<local-folder>/*", "<user>@<remote-host>:/var/tmp")
pushCmdOutput, err = pushCmd.CombinedOutput()
fmt.Fprintln(os.Stderr, string(pushCmdOutput))
Thanks in advance.