One thing i came across was a cheeky perl one liner
that just adds up the byte count for a directory,
doesn't descend tho:

ls -lAF | perl -e 'while (<>) { next if /^[dt]/; $sum += (split)[4] }
print "$sum\n"'


-thor



On Mon, 25 Mar 2002, P a u l Guth wrote:

> Is this different than
>
> du | sort -rn | less
>
> ?
>
> On Mon, Mar 25, 2002 at 07:18:03AM -0600, John Hunter wrote:
> >
> > For bare bones but effective, I wrote this little perl script.
> >
> > Usage:
> >
> > > du|sort-du|less
> >
> >
> > #!/usr/local/bin/perl -w
> > #sort the output from du; big dirs first
> >
> > use strict 'vars';
> >
> > my %dir_sizes;
> > while (<>) {
> >   if (m#^(\d+)\s+\./(.*)$#) {
> >       $dir_sizes{$2} = $1;
> >     }
> > }
> >
> > my @sorted_by_size = sort by_size keys %dir_sizes;
> > foreach(@sorted_by_size) {
> >   print "$dir_sizes{$_}\t$_\n";
> > }
> >
> > sub by_size {
> >   $dir_sizes{$b}<=>$dir_sizes{$a};
> > }
> >
> > _______________________________________________
> > Bits mailing list
> > [EMAIL PROTECTED]
> > http://www.sugoi.org/mailman/listinfo/bits
>
>

-- 
[[EMAIL PROTECTED] ]#


_______________________________________________
Bits mailing list
[EMAIL PROTECTED]
http://www.sugoi.org/mailman/listinfo/bits

Reply via email to