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) + } }