#!/usr/bin/php
<?php
function reDir($targetDirName){
	$targetDir = dir($targetDirName);
	echo($targetDir->path . "\n");
	while(false !== ($entry = $targetDir->read())){
		if($entry != "." && $entry != ".."){
			$newTarget = $targetDirName."/".$entry;
			echo($newTarget);
			if(is_dir($newTarget)){
				echo("*\n");
				reDir($newTarget);
			}else{
				if(eregi("(\.zip)$",$newTarget)){
					echo(" !\n");
					exec("unzip ". $newTarget. " -d ". eregi_replace("(\.zip)$","",$newTarget));
				}else{
					echo("\n");
				}
			}
		}
	}
	$targetDir->close();
}

$targetDirName = "/home/htaka/Documents/3DEnciclopediaClassicEdition";
reDir($targetDirName);
?>
