Skip to content

Commit

Permalink
recv create dsetination directory before single file transfer
Browse files Browse the repository at this point in the history
  • Loading branch information
so5 committed Oct 25, 2024
1 parent 2289ca7 commit ba78894
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lib/rsyncExec.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,9 @@ async function recv (hostInfo, argSrc, dst, rsyncOpt, timeout) {
args.unshift("--old-args");
}

// make destination directory if multi files will be transferd
if (argSrc.len > 1 || hasMagic(argSrc[0])) {
await fs.mkdir(dst, { recursive: true });
}
// make destination directory
const dstDir = argSrc.len > 1 || hasMagic(argSrc[0]) ? dst : path.dirname(dst);
await fs.mkdir(dstDir, { recursive: true });

debug(`recv ${src} to ${dst}`);
debugVerbose(`recv: ${rsyncCmd} ${args.join(" ")}`);
Expand Down

0 comments on commit ba78894

Please sign in to comment.