-
Isabella Skořepová authored
``` import fs from 'fs' import path from 'path' for (const file of traverse('content/articles')) { if (!file.endsWith('.md')) continue const dir = file.replace(/\.md$/, '') fs.mkdirSync(dir) fs.renameSync(file, path.join(dir, path.basename(file))) } function traverse(pathname) { const stat = fs.statSync(pathname) if (stat.isFile()) { return [pathname] } else if (stat.isDirectory()) { return fs .readdirSync(pathname) .map((v) => traverse(path.join(pathname, v))) .flat() } return [] } ```
a8a1ae32