diff --git a/source/snag/core/core.d b/source/snag/core/core.d index 7b05b61..9917240 100644 --- a/source/snag/core/core.d +++ b/source/snag/core/core.d @@ -442,4 +442,21 @@ class Snag { writeln("Import completed successfully: ", newSnapshot); } + + void size() { + try { + "Total size of the snapshots is: %.2f MB".writefln( + dirEntries(_config.git, SpanMode.depth) + .filter!(path => path.isFile) + .array + .map!(path => path.getSize) + .sum / (1024.0 * 1024.0) + ); + } catch (Exception e) { + throw new SnagException( + "Error while checking the snapshots size:\n\t" + ~ e.msg + ); + } + } }