1
0

Removed .Hours().

Reduced logClean output.
This commit is contained in:
Alexander Andreev 2022-02-08 02:35:48 +04:00
parent 338b153aa1
commit 29931cca2f
Signed by: Arav
GPG Key ID: 1327FE8A374CC86F

View File

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