From f3393b43f314113dae4cea5330abb93b5fb1a090 Mon Sep 17 00:00:00 2001 From: Chris Koeritz Date: Mon, 15 Jun 2015 11:13:02 -0400 Subject: [PATCH] slicker listing leaves off mbytes if there are none. also added gbytes count with same consideration. --- scripts/files/summing_dir.pl | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/scripts/files/summing_dir.pl b/scripts/files/summing_dir.pl index 4aa2031c..10604659 100644 --- a/scripts/files/summing_dir.pl +++ b/scripts/files/summing_dir.pl @@ -94,9 +94,19 @@ unlink($temp_file); # clean up. local($total)=int($lengths); local($kbytes)=int($total / 102.4) / 10; local($mbytes)=int($kbytes / 102.4) / 10; +local($gbytes)=int($mbytes / 102.4) / 10; print "\n"; -print "These files occupy $total bytes ($kbytes KB / $mbytes MB).\n"; +# print a fancy listing showing bytes at least, but only showing mb and gb if appropriate. +print "These files occupy $total bytes ($kbytes KB"; +if ($mbytes ne 0) { + print " / $mbytes MB"; +} +if ($gbytes ne 0) { + print " / $gbytes GB"; +} +print ").\n"; + print "Overall Drive Usage (megs):\n"; system("df -m $chewed_line >$temp_file"); -- 2.34.1