File size: 396 Bytes
2cae2a9
 
46fcec6
2cae2a9
 
1083ad0
2cae2a9
 
46fcec6
2cae2a9
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
import { promises as fs } from "node:fs"
import path from "node:path"
import { deleteFile } from "./deleteFile.mts"

export const deleteFilesWithName = async (dir: string, name: string, debug?: boolean) => {
  console.log(`deleteFilesWithName(${dir}, ${name})`)
  for (const file of await fs.readdir(dir)) {
    if (file.includes(name)) {
      await deleteFile(path.join(dir, file))
    }
  }
}