From 249b14c27e2d7ea0b07b57aaf1e9b2ac060dc68e Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Sun, 16 Jul 2023 23:04:20 +0200 Subject: [PATCH] actually delete the right amount of files --- nextcloud-upload/run.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nextcloud-upload/run.js b/nextcloud-upload/run.js index 1104c67..afca60a 100644 --- a/nextcloud-upload/run.js +++ b/nextcloud-upload/run.js @@ -53,7 +53,7 @@ async function upload() { let dirs = data["d:multistatus"]["d:response"].slice(1); // sort directories by last modified dirs.sort((a, b) => new Date(a["d:propstat"]["d:prop"]["d:getlastmodified"]) - new Date(b["d:propstat"]["d:prop"]["d:getlastmodified"])); - while (dirs.length > parseInt(retentionAmount)) { + while (dirs.length >= parseInt(retentionAmount)) { let dir = serverEnv + dirs[0]["d:href"]; let dirName = dir.substring(retentionPath.length - retentionBase.length).replace(/\/$/, ""); await axios.request({