Created
September 13, 2021 12:40
-
-
Save wrongbyte/a65b02b7f5e81a0b59228ad1fff0d2ec 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
const fs = require('fs'); | |
const path = require('path') | |
filePath = process.argv[2] | |
extension = '.' + process.argv[3] | |
fs.readdir(filePath, function(err, lsContent){ | |
if (err) return console.error(err) | |
lsContent = lsContent.filter(lsContent => path.extname(lsContent) == extension); | |
for (let i = 0; i < lsContent.length; i++){ | |
console.log(lsContent[i]) | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment