Filter options for copyDirSyncRecursive #31
1 changed files with 5 additions and 0 deletions
|
|
@ -183,6 +183,11 @@ exports.copyDirSyncRecursive = function(sourceDir, newDirLocation, opts) {
|
||||||
var files = fs.readdirSync(sourceDir);
|
var files = fs.readdirSync(sourceDir);
|
||||||
|
|
||||||
for(var i = 0; i < files.length; i++) {
|
for(var i = 0; i < files.length; i++) {
|
||||||
|
// ignores all files or directories which match the RegExp in opts.filter
|
||||||
|
if(!opts.whitelist && opts.filter && files[i].match(opts.filter)) continue;
|
||||||
|
// if opts.whitelist is true every file or directory which doesn't match opts.filter will be ignored
|
||||||
|
if(opts.whitelist && opts.filter && !files[i].match(opts.filter)) continue;
|
||||||
|
|
||||||
var currFile = fs.lstatSync(sourceDir + "/" + files[i]);
|
var currFile = fs.lstatSync(sourceDir + "/" + files[i]);
|
||||||
|
|
||||||
if(currFile.isDirectory()) {
|
if(currFile.isDirectory()) {
|
||||||
|
|
|
||||||
Reference in a new issue