projects
/
feisty_meow.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
taking out /etc/alternatives
[feisty_meow.git]
/
scripts
/
files
/
summing_dir.pl
diff --git
a/scripts/files/summing_dir.pl
b/scripts/files/summing_dir.pl
index fb32b956b293785ad8e16503bbe9a40ff874d49a..10604659bc4e40d5c9eb457fd82dbf73c152b0d1 100644
(file)
--- a/
scripts/files/summing_dir.pl
+++ b/
scripts/files/summing_dir.pl
@@
-38,6
+38,8
@@
if ($#ARGV < 0) {
}
foreach $dir (@arg_list) {
}
foreach $dir (@arg_list) {
+ if ($dir eq "-al") { next; } # skip ls directives.
+ if ($dir eq "-l") { next; } # skip ls directives.
$chewed_line = $chewed_line . " \"$dir\"";
}
$chewed_line = $chewed_line . " \"$dir\"";
}
@@
-49,8
+51,6
@@
if ("$chewed_line" eq "") {
# show the header, now that we know there's something to print.
print "[" . $print_list . "]\n\n";
# show the header, now that we know there's something to print.
print "[" . $print_list . "]\n\n";
-##print "chewed_line is: $chewed_line\n";
-
local($temp_file)=`mktemp "$TMP/zz_frdsumdir.XXXXXX"`;
chop($temp_file);
local($temp_file)=`mktemp "$TMP/zz_frdsumdir.XXXXXX"`;
chop($temp_file);
@@
-61,8
+61,6
@@
system("ls -HhlF $color_add $chewed_line > $temp_file");
# the color_add variable, if defined, will have flags for setting the
# directory listing color scheme.
# the color_add variable, if defined, will have flags for setting the
# directory listing color scheme.
-##print "file is: $temp_file\n";
-
local($lengths) = 0;
# open the file and process the lines to get file lengths.
local($lengths) = 0;
# open the file and process the lines to get file lengths.
@@
-72,7
+70,6
@@
$pattern="^[^ ]+ +[^ ]+ +[^ ]+ +[^ ]+ +([0-9.]+[KMG]?).*\$";
foreach $file_line (<DIRLIST>) {
if ($file_line =~ /$pattern/) {
(local $munged = $file_line) =~ s/$pattern/\1/;
foreach $file_line (<DIRLIST>) {
if ($file_line =~ /$pattern/) {
(local $munged = $file_line) =~ s/$pattern/\1/;
- #print "munge=$munged\n";
if ($munged =~ /K$/) {
chop $munged;
$munged *= 1024.0;
if ($munged =~ /K$/) {
chop $munged;
$munged *= 1024.0;
@@
-94,14
+91,22
@@
foreach $file_line (<DIRLIST>) {
close(DIRLIST);
unlink($temp_file); # clean up.
close(DIRLIST);
unlink($temp_file); # clean up.
-#print "lens are: $lengths\n";
-
local($total)=int($lengths);
local($kbytes)=int($total / 102.4) / 10;
local($mbytes)=int($kbytes / 102.4) / 10;
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 "\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");
print "Overall Drive Usage (megs):\n";
system("df -m $chewed_line >$temp_file");