Oh, code for deletion statistics also should be purged.
This commit is contained in:
parent
9510027d05
commit
85529890a5
@ -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++
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user