Es decir, esta bien echo este codigo:
Código PHP:
$filename = '$dir/comprovar.php';
if (file_exists($filename)) {
echo "The file $filename exists";
} else {
$origen="versiones/xg14c/";
$destino="$_POST[game]";
copy_directory($origen,$destino);
function copy_directory($origen,$destino)
{
if (is_dir($destino))
echo "";
else
mkdir("$destino");
if ($vcarga = opendir($origen))
{
echo "";
echo "";
while($file = readdir($vcarga))
{
if ($file != "." && $file != "..")
{
if (is_dir($origen."/".$file))
{
copy_diretory($origen."/".$file,$destino."/".$file);
}
else
{
if(copy($origen."/".$file, $destino."/".$file))
echo "";
}
}
}
closedir($vcarga);
}
}
}