Last active
October 4, 2017 15:42
-
-
Save anatolinicolae/ce7128b3d1166843cdfb89dbaeb8428d to your computer and use it in GitHub Desktop.
Sync source to dest with excludes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
const exec = require('child_process').exec | |
let source = process.argv[2] | |
let destination = process.argv[3] | |
let command = `rsync -avz ` | |
for (let i = 4; i < process.argv.length; i++) { | |
command += `--exclude "${process.argv[i]}" ` | |
} | |
command += `${source} ${destination}` | |
exec(command, (error, stdout, stderr) => { | |
if (error) { | |
console.error(`exec error: ${error}`) | |
return | |
} | |
console.log(`stdout: ${stdout}`) | |
console.log(`stderr: ${stderr}`) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment