Skip to content

Instantly share code, notes, and snippets.

@wrongbyte
Created September 13, 2021 12:40
Show Gist options
  • Save wrongbyte/a65b02b7f5e81a0b59228ad1fff0d2ec to your computer and use it in GitHub Desktop.
Save wrongbyte/a65b02b7f5e81a0b59228ad1fff0d2ec to your computer and use it in GitHub Desktop.
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