File size: 395 Bytes
f4d1a02
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import { readdir } from "node:fs/promises"
import path from "node:path"

import { deleteFile } from "./deleteFile"

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