#!/usr/bin/perl -w

$fileCount = 0; 
checkDir();
print "Total: $fileCount files\n";

sub checkDir
{
	print "checking a dir\n";
	my $allFiles = `echo *`;
	my @files = split(/ /, $allFiles);
	for(my $i = 0; $i <= $#files; $i++)
	{
		chomp($files[$i]);
		if(-f $files[$i])
		{	
			$fileCount++;
		}
		elsif(-d $files[$i])
		{
			chdir($files[$i]);
			print "moving to dir $files[$i]\n";
			checkDir();
			chdir("..");
		}
	}
}
