From 2d9d003b79cfa5ce51c9b798ed62e6be61b2ba90 Mon Sep 17 00:00:00 2001 From: Quentin Roussel Date: Sun, 25 Aug 2024 14:35:46 +0800 Subject: [PATCH] refresh file list before removing to attempt to fix #1 --- downloader.mjs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/downloader.mjs b/downloader.mjs index 4c6d208..9322f8d 100644 --- a/downloader.mjs +++ b/downloader.mjs @@ -95,6 +95,8 @@ export async function updateImages(count) { } //Remove old files + files = fs.readdirSync('images/raw'); + image_count = files.length; for (let file of files.sort().slice(0, image_count - count)) { console.log(`Deleting ${file}`); fs.unlinkSync(`images/raw/${file}`);