fshost / node-dir

Recursive asynchronous file and directory operations for Node.js
MIT License
221 stars 44 forks source link

match pattern for folder names? #48

Open QAscoop opened 7 years ago

QAscoop commented 7 years ago

Is it possible to use match pattern in folder or subfolder names similar to readFiles?

Here is an example file structure:

topFolder/
 -- myFiles/
 ---- file1.txt
 ---- file2.txt
-- otherFiles/
 ---- otherFile.htm
 ---- anotherFile.htm

I want to get the list of files inside "myFiles". The following code does not work:

dir.paths(folder, {
 match: /Tests/
 }, function(err, paths) {
  if (err) {
   console.log(err);
  }
  console.log("Folders FOUND: ", paths.dirs);
  console.log("FILES FOUND: ", paths.files);
 });