Last active
July 17, 2020 03:25
-
-
Save bengsiswantoh/322794b92d1051833a51b108981f6eb9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require("fs") | |
const path = require("path") | |
const getAllFiles = function(dirPath, arrayOfFiles) { | |
files = fs.readdirSync(dirPath) | |
arrayOfFiles = arrayOfFiles || [] | |
files.forEach(function(file) { | |
if (fs.statSync(dirPath + "/" + file).isDirectory()) { | |
arrayOfFiles = getAllFiles(dirPath + "/" + file, arrayOfFiles) | |
} else { | |
arrayOfFiles.push(path.join(__dirname, dirPath, "/", file)) | |
} | |
}) | |
return arrayOfFiles | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment