ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/gclib/scripts/duh
Revision: 24
Committed: Tue Jul 26 21:46:39 2011 UTC (8 years, 1 month ago) by gpertea
File size: 662 byte(s)
Log Message:
Line File contents
1 #!/usr/bin/perl
2 use strict;
3 my $usage = q/Usage:
4 duh [<directories..>]
5 Shows du with human
6 If no arguments are given, the size of all files and subdirectories
7 below the current directory is considered.
8 /;
9 umask 0002;
10 die($usage."\n") if $ARGV[0]=~m/^\-+h/;
11 my $cmd=(@ARGV==1) ? 'du -shx ' : 'du -schx ';
12 $cmd.=(@ARGV>0) ? join(' ',@ARGV) : '*';
13 open(DU, $cmd.'|') || die("Error starting $cmd | pipe!\n");
14 # Schwartzian transform
15 my %byte_order=(G => 0, M => 1, K => 2);
16 print map { $_->[0] }
17 sort { $byte_order{$main::a->[1]} <=> $byte_order{$main::b->[1]} || $main::b->[2] <=> $main::a->[2] }
18 map { [ $_, /([MGK])/, /(\d+)/ ] } <DU> ;
19 close(DU);

Properties

Name Value
svn:executable *