@pitaj thanx
G
Guyr989
@Guyr989
Posts
-
Node.js & cmd Filter file by extension and text in file -
Node.js & cmd Filter file by extension and text in fileI 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[2]; var words_in_file = process.argv[3];
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?
Thank you.