Created
October 28, 2016 15:21
-
-
Save LottieVixen/6afee5a6d6cac7a71a5d46238c2b949b to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| // take directory as arg1 take exetension filter #2, | |
| //output files that match the exetension | |
| // must use async readdir and a callback function | |
| var fs = require('fs'); | |
| var path = require('path'); | |
| var dir = process.argv[2]; | |
| var exe = '.'+process.argv[3]; | |
| function checkExtension(_,list){ | |
| lsArray = list; | |
| for (var i = 0;i <= lsArray.length - 1; i++) { | |
| if ((path.extname(lsArray[i])==exe)){ | |
| console.log(lsArray[i]); | |
| }; | |
| }; | |
| }; | |
| fs.readdir(dir,checkExtension) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment