#!/usr/local/bin/perl
chdir ("c:\\temp");
use Cwd;
$dir = cwd();
opendir (DH, $dir) || warn $!;
$sByteOffset = telldir DH;
$pbo = $sByteOffset;
while ($dirName = (readdir(DH))){
$dirNameLength = length($dirName);
$byteOffset = telldir DH;
$diff = $byteOffset - $pbo;
$totalSize = $pbo - $sByteOffset;
print "$dirName is $dirNameLength characters long at $pbo which is $diff bytes\n";
$pbo = $byteOffset;
}
print "Total directory bytes is: $totalSize\n";
|