simple/filesize/filesize

31 lines
540 B
Plaintext
Raw Normal View History

2010-04-24 17:25:15 +02:00
#!/usr/bin/perl
use warnings;
use strict;
use File::Find;
my %seen;
my %hist;
sub collect {
my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
$atime,$mtime,$ctime,$blksize,$blocks) = lstat($_);
return if $seen{"$dev:$ino"};
$hist{$size}++;
2016-07-05 20:19:21 +02:00
$seen{"$dev:$ino"} = 1;
2010-04-24 17:25:15 +02:00
}
find(\&collect, @ARGV ? @ARGV : ("."));
my $total_count;
for my $c (values %hist) {
$total_count += $c;
}
my $ac = 0;
for my $s (sort {$a <=> $b } keys %hist) {
$ac += $hist{$s};
printf "%g %g %6.2f\n", $s, $ac, 100 * $ac/$total_count;
}