Skip to content
Snippets Groups Projects
Commit ba8a883d authored by Niko Ehrenfeuchter's avatar Niko Ehrenfeuchter :keyboard:
Browse files

Sum up size of all expired directories in grace location summary

Relates to #20
parent fc475b81
Branches
No related tags found
No related merge requests found
......@@ -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;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment