communicator/winrm: make directory upload behave more like scp

changes behavior to be in-line with the docs.
Resolves #3562
This commit is contained in:
Matthew Hooker 2017-01-21 21:45:08 -08:00
parent 198824a25f
commit 85e85ddb47
No known key found for this signature in database
GPG Key ID: 7B5F933D9CE8C6A1
1 changed files with 5 additions and 0 deletions

View File

@ -5,6 +5,8 @@ import (
"io"
"log"
"os"
"path/filepath"
"strings"
"sync"
"github.com/masterzen/winrm"
@ -129,6 +131,9 @@ func (c *Communicator) Upload(path string, input io.Reader, _ *os.FileInfo) erro
// UploadDir implementation of communicator.Communicator interface
func (c *Communicator) UploadDir(dst string, src string, exclude []string) error {
if !strings.HasSuffix(src, "/") {
dst = fmt.Sprintf("%s\\%s", dst, filepath.Base(src))
}
log.Printf("Uploading dir '%s' to '%s'", src, dst)
wcp, err := c.newCopyClient()
if err != nil {