Skip to content

Commit

Permalink
Update purge.js
Browse files Browse the repository at this point in the history
  • Loading branch information
mazipan authored Feb 26, 2020
1 parent fb18939 commit d597265
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions purge.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -21,6 +24,4 @@ if (!namesToRemove.length) {
console.error(`Error deleting file for name: ${name}`);
}
});

fs.rmdirSync(peoplesPath);
}

0 comments on commit d597265

Please sign in to comment.