clapper / packages /io /src /delete /deleteFilesWithName.ts
shaw's picture
Add colors and io and move packages
5941ece
raw
history blame contribute delete
395 Bytes
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))
}
}
}