copyfiles-cli v0.1.0
copyfiles 
copy files easily
Install
npm install copyfiles -gCommand Line
Usage: copyfiles [options] inFile [more files ...] outDirectory
Options:
-h, --help output usage information
-V, --version output the version number
-u, --up [levels] slice a path off the bottom of the paths
-a --all include files and directories whose names begin with a dot (.)
-f, --flat flatten the output
-e, --exclude [pattern] pattern or glob to exclude
-s, --soft do not overwrite destination files if they existcopy some files, give it a bunch of arguments, (which can include globs), the last one is the out directory (which it will create if necessary). Note: on windows globs must by double quoted, everybody else can quote however they please.
copyfiles foo foobar foo/bar/*.js outyou now have a directory called out, with the files foo and foobar in it, it also has a directory named foo with a directory named bar in it that has all the files from foo/bar that match the glob.
If all the files are in a folder that you don't want in the path out path, ex:
copyfiles something/*.js outwhich would put all the js files in out/something, you can use the --up (or -u) option
copyfiles -u 1 something/*.js outwhich would put all the js files in out
you can also just do -f which will flatten all the output into one directory, so with files ./foo/a.txt and ./foo/bar/b.txt
copyfiles -f ./foo/*.txt ./foo/bar/*.txt outwill put a.txt and b.txt into out
if your terminal doesn't support globstars then you can quote them
copyfiles -f ./foo/**/*.txt outdoes not work by default on a mac
but
copyfiles -f "./foo/**/*.txt" outdoes.
You could quote globstars as a part of input:
copyfiles some.json "./some_folder/*.json" ./dist/ && echo 'JSON files copied.'You can use the -e option to exclude some files from the pattern, so to exclude all all files ending in .test.js you could do
copyfiles -e "**/*.test.js" -f ./foo/**/*.js outOther options include
-aor--allwhich includes files that start with a dot.-sor--softto soft copy, which will not overwrite existing files.
copyup
also creates a copyup command which is identical to copyfiles but -up defaults to 1
Programic API
var copyfiles = require('copyfiles');
copyfiles([paths], opt, callback);takes an array of paths, last one is the destination path, also takes an optional argument which the -u option if a number, otherwise if it's true it's the flat option.
8 years ago