Removed .Hours().
Reduced logClean output.
This commit is contained in:
parent
338b153aa1
commit
29931cca2f
@ -75,7 +75,7 @@ func main() {
|
|||||||
var deletedSize int64 = 0
|
var deletedSize int64 = 0
|
||||||
|
|
||||||
for _, entry := range uploadsDir {
|
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 {
|
if err := os.Remove(path.Join(config.Uploads.Directory, entry.Name())); err != nil {
|
||||||
logErr.Fatalln("failed to remove file ", entry.Name(), ": ", err)
|
logErr.Fatalln("failed to remove file ", entry.Name(), ": ", err)
|
||||||
}
|
}
|
||||||
@ -86,5 +86,7 @@ func main() {
|
|||||||
|
|
||||||
_, _, cFSz := utils.ConvertFileSize(deletedSize)
|
_, _, 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)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user