What about this? Any good?
Node.js & cmd Filter file by extension and text in file
I need to process/filter files by their extension and text inside the file.
It must be via the command-line.
This is the cmd line:
C:\myFolder> node search.js [extension][any text]
I only managed to isolate the 2 strings:
var file_extension = process.argv; var words_in_file = process.argv;
But now I need to build a filter that takes 2 args: 'file_extension' & 'words_in_file'
returns(display) a list of all files(full-path) ending with this extension (e.g txt/js/html etc..)
and containing the text of the second argument.
including in the sub folders files(if any).
1.How do I get only the files with the extension that was passed?(absolut path) 2.How do I read the file content and compare it to the text that was passed? 3.How to display it all in the cmd?
PitaJ Global Moderator Plugin & Theme Dev
It looks like you've misunderstood the purpose of this forum. This is the community forum for the Node.js-based forum software known as NodeBB.