Join the AI Workshop and learn to build real-world apps with AI. A hands-on, practical program to level up your skills.
To get all files in a folder recursively, use the glob library.
Install it:
npm install glob
For example, to find all index.md files under content/post (at any depth):
content/post/first/index.mdcontent/post/second/index.mdcontent/post/another/test/index.md
Example:
const glob = require('glob')
const root_folder = 'content/post'
glob(root_folder + '/**/index.md', (err, files) => {
if (err) {
console.log('Error', err)
} else {
console.log(files)
}
})