[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] This far...



>I've gotten this far, and the file does an iterated walk, finds and adds up
>the file sizes. The problem, probably a stupid one, is that it's not
>iterating. What am I doing wrong?
>
[stuff deleted]

$dir = "Internal:temp";
chdir $dir || die "Can't chdir $dir : $!";
&readDir( $dir );

sub readDir (){
	local($path) = @_;
	local($i);
	local($fil);
	opendir( DIR, $path ) || die "Can't open $path : $!";
	local(@fileList) = readdir( DIR );
	closedir( DIR );

	
	for ($i = 0; $i < $#fileList; $i++) {
		$fil = "$path:$fileList[$i]";
		@info = stat($fil);
#		print "$fil($fileList[$i]) $info[2]\n";
# in file tests '_' uses the result of the last stat call.
		if(-d _) {
			&readDir( "$fil" );
		}
		else{
# either of these works.
#			$total += $info[7];
			$total += -s _;
		}
	}
}
print "$total\n";


A problem, that I don't know the solution to, is that this
total only reflects the data fork sizes... I don't know how
to access the size of the resource fork.  I looked through
the macperl pod docs, couldn't find anything.

Tom.

Tom Kimpton
--
Mrs. Bun: Have you got anything without spam?
Waitress: Well, there's spam egg sausage and spam, that's not got
much spam in it.
Mrs. Bun: I don't want any spam!



***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch