Closed xied5531 closed 4 years ago
Hi, thanks for reporting the issue. I added two tests to try to reproduce the issue at https://github.com/hnakamur/go-scp/pull/21 but these tests passes.
Could you take look at test cases and verify they represents the issue you described? It would be helpful if you provide the failing test cases. Thanks!
@hnakamur
environment:
# pwd
/tmp/xxx
# find
.
api:
session.SendDir("D:\\tmp\\hello", "/tmp/xxx/hello", nil)
test:
first time:
# find
.
./hello
./hello/README.md
./hello/world
./hello/world/abc.txt
second time:
# find
.
./hello
./hello/README.md
./hello/world
./hello/world/abc.txt
./hello/hello
./hello/hello/README.md
./hello/hello/world
./hello/hello/world/abc.txt
actual result: two hello
expect result: same as first time or second time
@xied5531 Ah, for the first time, you specify the destination directory which does not exist.
The result you described is identical to that of scp -r
, so it is the expected result.
initial
$ find /tmp/hello
/tmp/hello
/tmp/hello/world
/tmp/hello/world/abc.txt
/tmp/hello/README.md
$ find /tmp/xxx
/tmp/xxx
first time
$ scp -r /tmp/hello /tmp/xxx/hello
$ find /tmp/xxx/hello
/tmp/xxx/hello
/tmp/xxx/hello/world
/tmp/xxx/hello/world/abc.txt
/tmp/xxx/hello/README.md
second time
$ scp -r /tmp/hello /tmp/xxx/hello
$ find /tmp/xxx/hello
/tmp/xxx/hello
/tmp/xxx/hello/world
/tmp/xxx/hello/world/abc.txt
/tmp/xxx/hello/README.md
/tmp/xxx/hello/hello
/tmp/xxx/hello/hello/world
/tmp/xxx/hello/hello/world/abc.txt
/tmp/xxx/hello/hello/README.md
OK
case1: dest dir not exist, result: create dir auto, OK
case1: dest dir has sub dir which name same as srd dir base name result: create sub dir of sub dir, No OK, should not create it
example:
destDir=/tmp/hello subDir=/tmp/hello/test
srcDir=/home/test
resultDir=/tmp/hello/test/test which should be /tmp/hello/test