code: function filteredFiles(folder, pattern) {
    var files = [];
      
    if (fs.existsSync(folder)){
      fs.readdirSync(folder).forEach(function(file) {
        if (file.match(pattern) != null)
          files.push(file);
      });
    }
    return files;
  }
docs: retrieve list of matching files in a folder