3 ms·
If you're using Windows, then I'd probably just use a script like this as well instead of trying to figure out whatever the equivalent of find is. If you're no
by russellbeattie 4y ago
If you're using Windows, then I'd probably just use a script like this as well instead of trying to figure out whatever the equivalent of find is.
If you're not using Windows, you should probably learn to use some basic shell commands.
Also, line 19 has a bug.
Also, readdir('foo', {withFileTypes: true}) will return a list of directory entries so you can check the type without doing a stat. Also, sync versions are easier.
fs.readdirSync(DOCS_DIR, {withFileTypes: true}).forEach((file) => {
if(file.name.startsWith('.') || !file.isDirectory()){ return; }
...
});