I forgot to mention that there are node modules that can do this for you:
https://github.com/isaacs/node-glob