Hi Craig, Thanks for sharing the script; very nice work. I like it much more than the one I sketched out for you.
Depending on your needs, you may want to consider my comments below. Mind the line wrap. --- Craig Sharp <[EMAIL PROTECTED]> wrote: <snip> > #!/usr/bin/perl -w use strict; > > use File::Find; > > open (DIROUT, ">dirlist.out") || die "$!"; > > @ARGV=('h:/') unless @ARGV; > my %exts; > > find \&sum_files, @ARGV; > > sub sum_files { > return if (-d $_); > my @pieces = split (/\./); > my $ext=scalar(@pieces)> 1 ? pop(@pieces) : > 'NO EXTENSION'; Your script keeps DLL, dll, and Dll as separate extensions. Maybe that is what you want. If not, then replace the about line with: my $ext= lc(scalar(@pieces)> 1 ? pop(@pieces) : 'NO EXTENSION'); to convert all to lower case and have just one subtotal for this extension. > $exts{$ext} += -s; > } > > select DIROUT; > > for (sort keys %exts) { > print "$_=>$exts{$_} bytes\n"; > } # print option. sort by size. largest to smallest. # %exts = reverse %exts; foreach ( sort {$b <=> $a} keys %exts) { print "$_ bytes", ' => ', "$exts{$_}\n"; } <snip the rest> --- Jim __________________________________________________ Do You Yahoo!? Great stuff seeking new owners in Yahoo! Auctions! http://auctions.yahoo.com _______________________________________________ Perl-Unix-Users mailing list. To unsubscribe go to http://listserv.ActiveState.com/mailman/subscribe/perl-unix-users