1
0

Added use of configuratuin param KeepForHours to decide if file is to be deleted.

This commit is contained in:
Alexander Andreev 2022-02-06 02:26:55 +04:00
parent d4852ee6dd
commit 8f9f4f0e30
Signed by: Arav
GPG Key ID: 1327FE8A374CC86F

View File

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