Skip to content
This repository has been archived by the owner on Jun 19, 2019. It is now read-only.

Commit

Permalink
Merge pull request #31 from donaldpipowitch/master
Browse files Browse the repository at this point in the history
Filter options for copyDirSyncRecursive
  • Loading branch information
Ryan McGrath committed Nov 9, 2012
2 parents d1ffccb + eb1bf23 commit 44b84fd
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/wrench.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,11 @@ exports.copyDirSyncRecursive = function(sourceDir, newDirLocation, opts) {
var files = fs.readdirSync(sourceDir);

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]);

if(currFile.isDirectory()) {
Expand Down

0 comments on commit 44b84fd

Please sign in to comment.