Node-SMB / marsaud-smb2

SMB2 Client
53 stars 46 forks source link

Checking files by wildcard #47

Closed eyzi closed 2 years ago

eyzi commented 5 years ago

Is it possible to search file by wildcard? eg, ABC._final would match ABC._final, ABC.js_final and ABC2019.js_final.

julien-f commented 5 years ago

Hi,

It's not supported directly but you should be able to easily do it yourself using readdir and a lib like micromatch:

async function glob(smb2Client, dir, pattern) {
  const entries = await smb2Client.readdir(dir)
  return micromatch(entries, pattern)
}