Created
January 9, 2014 21:33
-
-
Save ondrek/8342459 to your computer and use it in GitHub Desktop.
Walk recursivelly in NodeJs through all folders and subfolders and get all files
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
var _getFiles = function(dir) { | |
var results = []; | |
filesystem.readdirSync(dir).forEach(function(file) { | |
file = dir+'/'+file; | |
var stat = filesystem.statSync(file); | |
if (stat && stat.isDirectory()) { | |
results = results.concat(_getFiles(file)) | |
} else results.push(file); | |
}); | |
return results; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment