1
0

Oh, code for deletion statistics also should be purged.

This commit is contained in:
Alexander Andreev 2023-05-25 02:13:33 +04:00
parent 9510027d05
commit 85529890a5
Signed by: Arav
GPG Key ID: D22A817D95815393

View File

@ -30,16 +30,10 @@ func main() {
log.Fatalf("failed to open directory %s: %s\n", *uploadDir, err)
}
var deletedCount int64 = 0
var deletedSize int64 = 0
for _, entry := range uploadsDir {
if time.Now().UTC().Sub(entry.ModTime().UTC()) >= time.Duration(*keepFileForHours)*time.Hour {
if err := os.Remove(path.Join(*uploadDir, entry.Name())); err != nil {
log.Printf("failed to remove file %s: %s", entry.Name(), err)
} else {
deletedSize += entry.Size()
deletedCount++
}
}
}