davglass / cpr

Nodejs cp -R
Other
79 stars 80 forks source link

Filtering of items #61

Open soupman99 opened 5 years ago

soupman99 commented 5 years ago

Trying to filter the list of items to not include anything that is hidden ex: ._helloFile or ._helloWorld.jpg

Seems to not be working correctly AND the files array that is passed to the callback still returns everything in the source folder rather than my filtered results. What am I doing wrong?

    cpr(source, destination, {
      //deleteFirst: true, //Delete "to" before
      overwrite: true, //If the file exists, overwrite it
      confirm: true, //After the copy, stat all the copied files to make sure they are there
      filter:/^(^[_].*)*$/gmi
  }, function(err, files) {
      if(err){
        console.log(err)
        _self.logs = err;

      }else{
        console.log(files)

      }

  });