simple-copy
Simple copy-cli, copy files & directories width glob
Table of Contents
Installation
npm install simple-copy --save-dev
or
yarn add -D simple-copy
Usage
⚠️ Directory must end with
/
eg. /statics/images/
const copy = // copy(srcPath, dstPath[, options, callback]) /** * copy one file */ /** * copy files */// overwrite// do not overwrite /** * copy directory */
Options
src
{String|Object|Array}
Pattern to be matcheddest
{String | Function}
Destination directoryOptions
{Object}
flag or callback function.overwrite
{Boolean}
Overwrite existing filesdepth
{Boolean}
Recursive source directory
cb
{Function}
Called when an error occurs, or matches are founderror
{Error | null}
matches
{Array<String>}
filenames found matching the patterncurrentIndex
{Number}
The index of the current matching file
CLI
npm install --global simple-copy
or
yarn add -g simple-copy
CLI Useage
$ scopy <src> <dest> [...]
$ scopy --help
$ scopy -v
src
Pattern to be matcheddest
Destination directory[options]
-O
,--no-overwrite
Do not overwrite the destination-D
,--no-depth
Do not recursive source directory
Example
# Clone media to statics $ scopy src/media/ dist/statics/ $ scopy imgs/avatar.png imgs/*.jpg statics/ # Copy the avatar image of the png to statics directory $ scopy imgs/avatar/*.png statics/ -D