create temporary backup dir if not exist

This commit is contained in:
HF 2020-06-13 11:24:16 +02:00
parent dc9dc5f083
commit b70c7e0b3a

View File

@ -96,8 +96,9 @@ function runCmd(cmd: string) {
function getDateFolder() {
const dir = path.resolve(__dirname, BACKUP_DIR);
if (!fs.existsSync(dir)) {
console.error(`Backup directory ${BACKUP_DIR} does not exist!`);
process.exit(1);
// eslint-disable-next-line max-len
console.error(`Backup directory ${BACKUP_DIR} does not exist! Trying to create it`);
fs.mkdirSync(BACKUP_DIR);
}
const date = new Date();
let month = date.getMonth() + 1;