From e8267a75ceef721715de17e61f40b65eb93f8ca7 Mon Sep 17 00:00:00 2001 From: Ryan Kavanagh Date: Fri, 11 Dec 2020 17:11:09 -0500 Subject: Keep files larger than max_size for 7 days --- cleanup.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'cleanup.c') diff --git a/cleanup.c b/cleanup.c index d308a12..62b0dd4 100644 --- a/cleanup.c +++ b/cleanup.c @@ -29,6 +29,7 @@ #include #include +const double bigd = 7.0; const double mind = 30.0; const double maxd = 90.0; const double max_size = 33554432; // 32MB @@ -82,8 +83,11 @@ main(int argc, char * const argv[]) break; } file_age = difftime(curr_time, attr.st_mtime) / 86400.0; - cutoff = mind + (mind - maxd) * - pow((double) attr.st_size / (double) max_size - 1, 3.0); + if (attr.st_size > max_size) + cutoff = bigd; + else + cutoff = mind + (mind - maxd) * + pow((double) attr.st_size / (double) max_size - 1, 3.0); if (verbose) printf("%s age %fd cuttoff %fd size %lldB\n", node->fts_path, file_age, cutoff, attr.st_size); -- cgit v1.2.3