Created
December 26, 2014 15:24
-
-
Save MhdAljuboori/1392f282613a57aa4e9b to your computer and use it in GitHub Desktop.
Explore Folder Using NodeJS
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
function printRoot (folderPath) { | |
console.log("----" + folderPath); | |
sh.cd(folderPath); | |
var files = sh.ls() || []; | |
for (var i=0; i<files.length; i++) { | |
var file = files[i]; | |
if (file.match(/.*\.js/)) | |
console.log(file); | |
else { | |
printRoot(file); | |
sh.cd('../'); | |
} | |
} | |
} | |
printRoot(sh.pwd()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment