From a38764ca860d6329b106b1d966ff6ea623067853 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Sun, 26 Jul 2015 14:23:06 -0700 Subject: [PATCH] In casttypeC should verify target is Dir() or exit, if doesn't exist let it create one --- cast-url.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cast-url.go b/cast-url.go index cb01ff61..759469c0 100644 --- a/cast-url.go +++ b/cast-url.go @@ -168,8 +168,11 @@ func checkCastSyntaxTypeC(srcURL string, tgtURLs []string) { console.Fatalf("Source ‘%s’ is not a folder. %s\n", stripRecursiveURL(srcURL), NewIodine(iodine.New(err, nil))) } for _, tgtURL := range tgtURLs { - if !isTargetURLDir(tgtURL) { - console.Fatalf("One of the target ‘%s’ is not a folder. cannot have mixtures of directories and files while copying directories recursively. %s\n", tgtURL, NewIodine(iodine.New(errInvalidArgument{}, nil))) + _, content, err := url2Stat(tgtURL) + if err == nil { + if !content.Type.IsDir() { + console.Fatalf("One of the target ‘%s’ is not a folder. cannot have mixtures of directories and files while copying directories recursively. %s\n", tgtURL, NewIodine(iodine.New(errInvalidArgument{}, nil))) + } } } }