Skip to content

Commit

Permalink
fix folder delete issue
Browse files Browse the repository at this point in the history
  • Loading branch information
RileySeaburg committed Jul 11, 2024
1 parent 483fce2 commit c2bb85a
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions config/gulp/file-upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
}

Expand Down

0 comments on commit c2bb85a

Please sign in to comment.