spmjs / node-scp2

[MAINTAINER WANTED] A pure javascript scp program based on ssh2.
384 stars 96 forks source link

"glob *" writes to wrong destination folder #27

Open rondonjon opened 9 years ago

rondonjon commented 9 years ago

Source OS: Windows 7 Pattern: C:\Users\aaa\bbb\ccc*

Destination OS: Linux Folder: /home/target/out/

Expected Result Everything in source folder C:\Users\aaa\bbb\ccc should be copied into destination directory /home/target/out/ (which already exists when scp is called)

Actual Result Only the first file from the source folder is copied to the correct destination folder. All other files are copied to the PARENT folder of the destination folder instead, i.e. to /home/target/ instead of /home/target/out/

Sample Code

function run(srcFolder, dstConfig, cb) {

    var src = path.join(srcFolder, "*");

    // the following shows C:\Users\aaa\bbb\ccc\*
    console.log("source pattern: " + src);

    // the following shows /home/target/out/
    console.log("destination folder: " + dstConfig.path);

    scp(src, dstConfig, function(err) {
        cb(err);
    });
}
rondonjon commented 9 years ago

Interesting. It works when I append '*' instead of ''.

martinvl commented 9 years ago

+1

Seeing exactly the same. The first file is copied to the correct location, while the others are copied to the parent directory.

raduGaspar commented 7 years ago

why isn't this fixed merged yet?