mirror of
https://github.com/Sebclem/hassio-nextcloud-backup.git
synced 2024-12-23 22:46:44 +01:00
🔨 Clean the entire temp folder on upload end
This commit is contained in:
parent
cd7ca7344d
commit
bf8d271f4d
@ -198,7 +198,7 @@ class WebdavTools {
|
||||
status.last_backup = moment().format('MMM D, YYYY HH:mm')
|
||||
|
||||
statusTools.setStatus(status);
|
||||
fs.unlinkSync('./temp/' + id + '.tar')
|
||||
cleanTempFolder();
|
||||
resolve();
|
||||
}
|
||||
})
|
||||
@ -219,6 +219,16 @@ class WebdavTools {
|
||||
|
||||
|
||||
|
||||
function cleanTempFolder(){
|
||||
fs.readdir("./temp/", (err, files) => {
|
||||
if (err) throw err;
|
||||
|
||||
for (const file of files) {
|
||||
fs.unlink(path.join("./temp/", file), err => {
|
||||
if (err) throw err;
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user