Skip to content

Instantly share code, notes, and snippets.

@cloudhead
Created June 17, 2010 05:30
Show Gist options
  • Save cloudhead/441725 to your computer and use it in GitHub Desktop.
Save cloudhead/441725 to your computer and use it in GitHub Desktop.
var sys = require('sys'),
path = require('path'),
spawn = require('child_process').spawn;
var arg = path.join(process.cwd(), '**/*.js');
var glob = spawn('ls', [arg]);
var files = [];
glob.stdout.addListener('data', function (data) {
Array.prototype.push.apply(files, data.toString().trim().split(/[\s\n]+/g));
});
glob.addListener('exit', function (code) {
sys.puts(sys.inspect(files));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment