Leser: 3
9 Einträge, 1 Seite |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
my $PICDIR = q{./pictures}; ### get dir size use File::Size; my $fsobj = File::Size->new( dir => $PICDIR, blocksize => 1024, followsymlinks => 1, humanreadable => 1 ); my $pic_dir_size = $fsobj->getsize(); my $pic_dir_exist = -e $PICDIR; print $pic_dir_size ."\n". $pic_dir_exist;
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
sub getdirsize { my( $dir ) = @_; my $size = 0; opendir( my $dh, $dir ) or die "Cannot opendir '$dir': $!\n"; for my $i ( readdir( $dh ) ) { my $s = -s "$dir/$i"; $size += $s; $size += getdirsize( "$dir/$i" ) if -d "$dir/$i" && $i !~ /^\.\.?$/; } # for closedir( $dh ); return $size; } # getdirsize
... && $i !~ /^\.\.?$/;
9 Einträge, 1 Seite |