-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
37 lines (21 loc) · 737 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/env node
var fs = require('fs');
var fse = require('fs-extra');
var example = "Please make sure that what you entered is similar to this : "+ "\"/path/to/one,/path/to/two\"" + " " + "\"/dest/to/one,/dest/to/two\""
try {
var src = process.argv[2];
var dest = process.argv[3];
var srcList = src.split(",")
var destList = dest.split(",")
for(var i = 0 ; i < srcList.length;i+=1) {
var sourceDir = srcList[i];
var destDir = destList[i];
if (!fs.existsSync(destDir)){
fs.mkdirSync(destDir, { recursive: true });
}
fse.copy(sourceDir, destDir);
console.log("success! copied: " + sourceDir + " to: " + destDir + " ");
}
} catch (error) {
console.error(example);
}