Learn how to make a recursive directory listing with node.js using module fs and path. It list the and every files within a directory. This can be used for batch image processing or making an index of files etc.
Here is the video tutorial.
Source Code :
var fs = require('fs'), path = require('path'); function crawl(dir){ console.log('[+]',dir); var files = fs.readdirSync(dir); for(var x in files){ var next = path.join(dir,files[x]); //console.log(next); if(fs.lstatSync(next).isDirectory()==true){ crawl(next); } else { console.log('\t',next); } } } crawl(__dirname);