copydir.js 551 B

123456789101112131415161718192021
  1. #!/usr/bin/env node
  2. const argv = process.argv
  3. if (argv.length <= 3) {
  4. console.log('Usage: node copydir.js from to')
  5. return
  6. }
  7. const fromParam = argv[2]
  8. const toParam = argv[3]
  9. console.log("Try copy " + fromParam + " to " + toParam + "\n\n")
  10. var copydir = require('copy-dir');
  11. copydir.sync(fromParam, toParam, {
  12. utimes: true, // keep add time and modify time
  13. mode: true, // keep file mode
  14. cover: true // cover file when exists, default is true
  15. });
  16. process.stdout.write(' Copied ' + fromParam + ' to the ' + toParam + ' \n\n');