-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsync.js
More file actions
29 lines (23 loc) · 766 Bytes
/
sync.js
File metadata and controls
29 lines (23 loc) · 766 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
"use strict";
require("dotenv").config({ silent: true });
const rsync = require("rsyncwrapper");
const sshUser = process.env.SSH_USER || "or <ENTER SSH USERNAME>";
const sshHost = process.env.SSH_HOST || "or <ENTER SSH HOST>";
const fromFolder = "./src/"; // use a trailing backslash for recursive
const toFolder = "path/to/folder"; // don't use a trailing backslash
const excludedFiles = [
".DS_Store",
".gitkeep"
];
rsync({
src: fromFolder,
dest: `${ sshUser }@${ sshHost }:${ toFolder }`,
recursive: true,
exclude: excludedFiles
}, (error, stdout, stderr, cmd) => {
if (error) {
return console.log(error.message, stdout, stderr, cmd);
} else {
return console.log(`--> ${ fromFolder } sucessfully synced with ${ toFolder }`);
}
});