Ejemplo n.º 1
0
	function CopyDir($from, $to, $children = true)
	{
		if(is_dir($from) == false)Return false;
		if(is_dir($to) == false)
		{
			if(IoHandler::MakeDir($to) == false)
			{
				Return false;
			}
		}
		$from_handle = opendir($from);
		while(($file = readdir($from_handle)) !== false)
		{
			if($file != '.' and $file != '..')
			{
				$from_abs_path = $from . '/' . $file;
				$to_abs_path = $to . '/' . $file;
				if(is_dir($from_abs_path) != false and $children == true)
				{
					IoHandler::MakeDir($to_abs_path);
					IoHandler::CopyDir($from_abs_path, $to_abs_path, $children);
				}
				if(is_file($from_abs_path) != false)
				{
					if(copy($from_abs_path, $to_abs_path) == false)
					{
						Return false;
					}
				}
			}
		}
		closedir($from_handle);
		Return true;
	}