JS Obtenha arquivos
/*--------------------------------------------------------------------------------------\
| _______ _ _____ _ _ _ ________ ___ ___ ___ __ |
| |__ __| (_) / ____| | | (_) / ____ \ |__ \ / _ \__ \/_ | |
| | | __ _ _ | (___ | |_ _ _ __| |_ ___ / / ___| \ ) | | | | ) || | |
| | |/ _` | | \___ \| __| | | |/ _` | |/ _ \ | | | | / /| | | |/ / | | |
| | | (_| | | ____) | |_| |_| | (_| | | (_) | | | |___ | / /_| |_| / /_ | | |
| |_|\__,_|_| |_____/ \__|\__,_|\__,_|_|\___/ \ \____| / |____|\___/____||_| |
| \________/ |
\--------------------------------------------------------------------------------------*/
const fs = require('fs');
function getFiles(dir, files_){
files_ = files_ || [];
var files = fs.readdirSync(dir);
for (var i in files){
var name = dir + '/' + files[i];
if (fs.statSync(name).isDirectory()){
console.log(`INFO: ${name}`)
getFiles(name, files_);
}
}
return files_;
}
getFiles(testFolder);
Tai