-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathautoscp.js
More file actions
32 lines (26 loc) · 905 Bytes
/
autoscp.js
File metadata and controls
32 lines (26 loc) · 905 Bytes
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
export function autoScp(ns, serverArray, scriptNameShare, scpSource, verbose) {
let successCount = 0;
for(let i = 0; i < serverArray.length; i++) {
let scpDestination = serverArray[i];
if(scpDestination == scpSource) {
continue;
}
if(scpDestination == "home") {
ns.tprintf("skipped scp - you might overwrite important files at home");
continue;
}
if( ns.scp(scriptNameShare, scpDestination, scpSource) ){
successCount++;
}
}
if(verbose) {
ns.tprintf("%s -> autoScp(serverArray[%i], scriptNameShare=%s, scpSource=%s, verbose=%s) = successCount = %i",
ns.getScriptName(), serverArray.length, scriptNameShare, scpSource, verbose, successCount
);
}
return successCount;
}
/** @param {NS} ns */
export async function main(ns) {
// don't add a posibility to call this from terminal, will result in fuck-up inevitably
}