From 29931cca2f0b1077a99ad6dd307e8db322f98ac4 Mon Sep 17 00:00:00 2001 From: "Alexander \"Arav\" Andreev" Date: Tue, 8 Feb 2022 02:35:48 +0400 Subject: [PATCH] Removed .Hours(). Reduced logClean output. --- cmd/dwelling-upload-clear/main.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cmd/dwelling-upload-clear/main.go b/cmd/dwelling-upload-clear/main.go index 3e4d152..948e0b9 100644 --- a/cmd/dwelling-upload-clear/main.go +++ b/cmd/dwelling-upload-clear/main.go @@ -75,7 +75,7 @@ func main() { var deletedSize int64 = 0 for _, entry := range uploadsDir { - if time.Duration(entry.ModTime().UTC().Sub(time.Now().UTC()).Hours()) >= time.Duration(config.Uploads.Limits.KeepForHours)*time.Hour { + if time.Duration(entry.ModTime().UTC().Sub(time.Now().UTC())) >= time.Duration(config.Uploads.Limits.KeepForHours)*time.Hour { if err := os.Remove(path.Join(config.Uploads.Directory, entry.Name())); err != nil { logErr.Fatalln("failed to remove file ", entry.Name(), ": ", err) } @@ -86,5 +86,7 @@ func main() { _, _, cFSz := utils.ConvertFileSize(deletedSize) - logClean.Println(deletedCount, "file(s) in total of", cFSz, "was removed during this run.") + if deletedCount > 0 { + logClean.Printf("%d %s", deletedCount, cFSz) + } }