From 0b3a102dda1fedab1a275d5a32013fdc7ca4c2ca Mon Sep 17 00:00:00 2001 From: Miles Hilton Date: Mon, 23 Sep 2024 12:28:09 -0400 Subject: [PATCH] fixing duplicate output folder names --- src/main.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main.ts b/src/main.ts index 31e8d21..e34bb5f 100644 --- a/src/main.ts +++ b/src/main.ts @@ -31,7 +31,13 @@ if (!fs.existsSync(join(__dirname, outDir))) { for (let url of urlsList) { console.log(`Scanning ${url} ...`); const urlObj = new URL(url); - const folderStructure = `${outDir}/${urlObj.hostname}`; + let folderStructure = `${outDir}/${urlObj.hostname}`; + + if (fs.existsSync(join(__dirname, folderStructure))) { + const timestamp = Date.now(); + folderStructure += `-${timestamp}`; + } + const config = { headless: true, outDir: join(__dirname, folderStructure),