node.js glob pattern for excluding multiple files

I suppose it’s not actual anymore but I got stuck with the same question and found an answer.

This can be done using only glob module.
We need to use options as a second parameter to glob function

glob('pattern', {options}, cb)

There is an options.ignore pattern for your needs.

var glob = require('glob');

glob("**/*",{"ignore":['index.html', 'js', 'js/app.js', 'js/lib.js']}, function (err, files) {
  console.log(files);
})

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)