function gatherFilesFromDir(startPath, cfg = gatherFilesConfig, result = []) {
  const files = fs.readdirSync(startPath);
  files.forEach(file => {
    const filePath = path.join(startPath, file);
    const stat = fs.lstatSync(filePath);
    if (stat.isDirectory()) {
      const folderName = filePath.replace(/.*\/([^/]+)$/, '$1');
      if (!cfg.excludeFolders.includes(folderName)) {
        gatherFilesFromDir(filePath, cfg, result); // search recursively
      }
    } else if (filePath.endsWith(cfg.extension)) {
      const fileName = filePath.replace(/.*\/([^/]+)$/, '$1');
      if (!cfg.excludeFiles.includes(fileName)) {
        result.push(filePath);
      }
    }
  });
  return result;
}
Gets an array of files for given extension
@param {string} startPath - local filesystem path
@param {object} cfg - configuration object
@param {string} cfg.extension - file extension like '.md'
@param {string[]} cfg.excludeFiles - file names filtered out
@param {string[]} cfg.excludeFolders - folder names filtered out
@param {string[]} result - list of file paths
@returns {string[]} result list of file paths