Main code here . . . pathstat($pathname, $file_count, $dir_count, $total_size, $aged_file_count, $aged_total_size); print "\n\nFile Statistics for $pathname\n". "\ntotal file count is $file_count\n". "total dir count is $dir_count\n". "total size is $total_size\n\n". "number of files between $lowrange and $highrange days old is $aged_file_count\n". "total size of aged files is $aged_total_size\n"; . . . sub pathstat { my($arg_pathname) = $_[0]; my($dir_entry); my($dir_handle) = "BIN" . $_[2]; my($file_age); my($file_size); opendir($dir_handle, $arg_pathname) or die "Can't open $arg_pathname: $!"; while (defined($dir_entry = readdir $dir_handle)) { if (-d $arg_pathname . "\\" . $dir_entry) { if ($dir_entry ne "." && $dir_entry ne "..") { ++$_[2]; pathstat($arg_pathname . "\\" . $dir_entry, $_[1], $_[2], $_[3], $_[4], $_[5]); } } else { ++$_[1]; $file_size = (-s $arg_pathname . "\\" . $dir_entry); $_[3] += $file_size; $file_age = (-C $arg_pathname . "\\" . $dir_entry); if ($file_age >= $lowrange && $file_age <= $highrange) { ++$_[4]; $_[5] += $file_size; } } } closedir($dir_handle); }