Created
January 27, 2014 17:30
-
-
Save phillipalexander/8653269 to your computer and use it in GitHub Desktop.
filter files in cwd to js files
This file contains 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
var util = require('util'); | |
var path = require('path'); | |
var fs = require('fs'); | |
var allFiles = fs.readdirSync(process.cwd()) | |
var jsFiles = []; | |
for (var i = 0; i < allFiles.length ; i++) { | |
var selectedFile = allFiles[i]; | |
if (selectedFile.substr(selectedFile.length - 3) === '.js') { | |
jsFiles.push(selectedFile); | |
} | |
} | |
console.log(jsFiles) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment