From ba8a883d4720cb5ecd704c323b25dde016f6a08b Mon Sep 17 00:00:00 2001 From: Niko Ehrenfeuchter <nikolaus.ehrenfeuchter@unibas.ch> Date: Thu, 2 May 2019 11:22:45 +0200 Subject: [PATCH] Sum up size of all expired directories in grace location summary Relates to #20 --- ATxCommon/StorageStatus.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ATxCommon/StorageStatus.cs b/ATxCommon/StorageStatus.cs index dac86d8..c5a4a43 100644 --- a/ATxCommon/StorageStatus.cs +++ b/ATxCommon/StorageStatus.cs @@ -82,6 +82,7 @@ namespace ATxCommon /// and all expired directories, grouped by the topmost level (i.e. user dirs).</returns> public string GraceLocationSummary() { UpdateGraceLocation(); + long totalSizeExpired = 0; var summary = "------ Grace location status, " + $"threshold: {_gracePeriod} days ({_gracePeriodHuman}) ------\n\n" + $" - location: [{_graceLocation}]\n"; @@ -92,12 +93,15 @@ namespace ATxCommon foreach (var dir in _expiredDirs.Keys) { summary += "\n - directory '" + dir + "'\n"; foreach (var subdir in _expiredDirs[dir]) { + totalSizeExpired += subdir.Size; summary += $" - {subdir.Dir.Name} " + $"[age: {subdir.HumanAgeFromName}, " + $"size: {subdir.HumanSize}]\n"; } } + summary += $"\n - sum of expired folders: {Conv.BytesToString(totalSizeExpired)}\n"; + return summary; } -- GitLab