i had my math right the first time

or close
idk
This commit is contained in:
Adam R Grey 2023-12-10 11:47:49 -05:00
parent 799eac006a
commit ba924775f2

View File

@ -42,11 +42,14 @@
if(feed.KeepCount != null && feed.KeepCount > 0)
{
var files = Directory.GetFiles(feed.OutputDir, "*" + ext);
if(files.Length > feed.KeepCount -1)
//Console.WriteLine($"in {feed.OutputDir}, I see {files.Count()} files with extension {ext}");
if(files.Length > feed.KeepCount - 1)
{
files = files.Order().Take((int)feed.KeepCount -1).ToArray();
files = files.Order().Take(files.Length - (int)feed.KeepCount + 1).ToArray();
//Console.WriteLine($"filtered down to {files.Length}");
foreach(var f in files)
{
Console.WriteLine($"deleting {f}");
File.Delete(f);
}
}