1 var fs = require("fs");
2 var path = require("path");
5 // comes from http://stackoverflow.com/questions/5827612/node-js-fs-readdir-recursive-directory-search
6 var walk = function(dir, done) {
9 fs.readdir(dir, function(err, list) {
10 if (err) return done(err);
14 if (!file) return done(null, results);
15 file = path.normalize(dir + "/" + file);
16 fs.stat(file, function(err, stat) {
17 if (stat && stat.isDirectory()) {
18 walk(file, function(err, res) {
19 results = results.concat(res);
23 if(!file.match(/.*\.meta.*\.filesize/)) results.push(file);
31 walk("/tmp/cache/ubuntu", function(err, res) {
32 console.log("result: ", res);