In node.js, can I list files with wild card matching like
fs.readdirSync(\'C:/tmp/*.csv\')?
I did not find the information on wild card ma
dont reinvent the wheel, if you are on *nix the ls tool can easily do this (node api docs)
var options = {
cwd: process.cwd(),
}
require('child_process')
.exec('ls -1 *.csv', options, function(err, stdout, stderr){
if(err){ console.log(stderr); throw err };
// remove any trailing newline, otherwise last element will be "":
stdout = stdout.replace(/\n$/, '');
var files = stdout.split('\n');
});