How to copy folder in nodej

Issue #651

Use shelljs

1
npm install shelljs
1
2
const shell = require('shelljs')
shell.exec(`cp -a source_path/. destination_path`)

The -a option is an improved recursive option, that preserve all file attributes, and also preserve symlinks.

The . at end of the source path is a specific cp syntax that allow to copy all files and folders, included hidden ones.
Updated at 2020-05-07 04:10:05

Comments