From c2bb85a83c0ff7d9c7e88b48008a894806c9dd40 Mon Sep 17 00:00:00 2001 From: Riley Seaburg Date: Thu, 11 Jul 2024 16:23:08 -0500 Subject: [PATCH] fix folder delete issue --- config/gulp/file-upload.js | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/config/gulp/file-upload.js b/config/gulp/file-upload.js index 9f43a499c7..f50afa6d36 100644 --- a/config/gulp/file-upload.js +++ b/config/gulp/file-upload.js @@ -65,20 +65,18 @@ function uploadFile() { function cleanup() { return new Promise((resolve, reject) => { let imageDir = "content/uploads/_working-images/processed"; - let fileDir = "content/uploads/_working-files/to-process"; + let fileDir = "content/uploads/_working-files"; if (fs.existsSync(imageDir)) { - if (fs.readdirSync(imageDir).length > 0) { - console.log(`Images have number of files ${fs.readdirSync(imageDir).length}`); - // delete tht folder - del([imageDir]); - resolve(); - } else { - resolve(); - } - } else { - resolve(); + // remove the folder + del([imageDir]); + } + + if (fs.existsSync(fileDir)) { + // remove the folder + del([fileDir]); } + resolve(); }); }