// Name: Delete Orphaned Files
// Description: Find and delete files that are no longer referenced or needed
// Author: BrickyOnYT
import "@johnlindquist/kit"
interface OrphanedFile {
path: string
reason: string
size: number
}
const scanDirectory = async (dirPath: string): Promise<OrphanedFile[]> => {
const orphanedFiles: OrphanedFile[] = []
try {
const items = await readdir(dirPath, { withFileTypes: true })
for (const item of items) {
const fullPath = path.join(dirPath, item.name)