Ameet, Here's a code fragment that, given a starting directory (folder), will recursively descend and do something for each file: use Mac::Files; $total = 0; $totalPhys = 0; $dir = "Internal:temp"; sub fileRoutine() { local($fil) = @_; # do your per file stuff here. The following 3 code lines # are an example. $has = FSpGetCatInfo($fil); $total += $has->{ioFlLgLen} + $has->{ioFlRLgLen}; $totalPhys += $has->{ioFlPyLen} + $has->{ioFlRPyLen}; } sub recurseDir () { local($path, $fileOperator) = @_; local($i); local($fil); local(@info); opendir( DIR, $path ) || die "Can't open $path : $!"; local(@fileList) = readdir( DIR ); closedir( DIR ); # Unless you change $[, Perl arrays are zero based... # $# is the index of the last item in the array, so # we need to add 1 to get the size of the array. $numFiles += $#fileList + 1; for ($i = 0; $i <= $#fileList; $i++) { $fil = "$path:$fileList[$i]"; # Evidently Stuffit Expander had a bug where it # created files with an empty name. if(!$fileList[$i]) { next; } next if($fileList[$i] =~ /icon\n/i); # skip over custom icon files. @info = stat($fil); if( -d _ ) { if(! -l $fil) # don't follow aliases, if they're in the directory structure # we'll eventually get to them, if they're not, we probably # don't want to go to them. { &recurseDir( "$fil" , $fileOperator); } } else { &$fileOperator($fil); } } } &recurseDir( $dir , \&fileRoutine); print "$numFiles for $total(logical) bytes, $totalPhys(physical) bytes\n"; 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