diff --git a/purge.js b/purge.js index fc7675766..749c5b209 100644 --- a/purge.js +++ b/purge.js @@ -8,11 +8,14 @@ const peoplesPath = path.join(__dirname, "peoples"); if (!namesToRemove.length) { fs.readdirSync(peoplesPath).forEach(file => { if (file.indexOf('mazipan.js') < 0) { - fs.unlinkSync(path.join(peoplesPath, file)) + try{ + fs.unlinkSync(path.join(peoplesPath, file)); + console.log(`Success deleting file: ${file}`); + }catch (e) { + console.error(`Error deleting file: ${file}`); + } } }); - - fs.rmdirSync(peoplesPath); } else { namesToRemove.forEach(name => { try { @@ -21,6 +24,4 @@ if (!namesToRemove.length) { console.error(`Error deleting file for name: ${name}`); } }); - - fs.rmdirSync(peoplesPath); }