grunt-multi-dest
Version:
Run predefined tasks multiple times to copy their output to multiple destinations and avoid duplication
22 lines (18 loc) • 532 B
JavaScript
var fs = fs || require('fs');
var getDirRecursiveSync = function(dir, filelist) {
var files = fs.readdirSync(dir);
filelist = filelist || [];
var fileLength = files.length;
for (var i=0; i<fileLength; i++)
{
var file = files[i];
var path = dir + file;
if (fs.statSync(path).isDirectory()) {
filelist = getDirRecursiveSync(path + '/', filelist);
} else {
filelist.push(path);
}
}
return filelist;
};
module.exports = getDirRecursiveSync;