Added use of configuratuin param KeepForHours to decide if file is to be deleted.
This commit is contained in:
parent
d4852ee6dd
commit
8f9f4f0e30
@ -28,7 +28,7 @@ func main() {
|
||||
var deteted_size int64 = 0
|
||||
|
||||
for _, entry := range uploads_dir {
|
||||
if time.Duration(entry.ModTime().UTC().Sub(time.Now().UTC()).Hours()) >= 24*time.Hour {
|
||||
if time.Duration(entry.ModTime().UTC().Sub(time.Now().UTC()).Hours()) >= time.Duration(config.Uploads.Limits.KeepForHours)*time.Hour {
|
||||
if err := os.Remove(path.Join(config.Uploads.Directory, entry.Name())); err != nil {
|
||||
log.Fatalln("failed to remove file ", entry.Name(), ": ", err)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user