Hi Everyone…
Following is the function which to copy the compete directory structure from source to destination. This function was used extensively by me in my final year project…
function GetContents (&$noOfFiles, &$noOfDir, $sourceDirectory)
{
$delim = DIRECTORY_SEPARATOR;
$tempCWD = $sourceDirectory;
@chdir ($tempCWD);
$Contents = Array();
$dirPtr = dir (getcwd());
while ($file = $dirPtr->read())
{
if ($file != "." && $file != ".." && is_dir($file) && $file{0} != "." && $file != "trash")
{
$noOfDir++;
$Contents[] = $file;
}
else if ($file != "." && $file != ".." && is_file($file) && $file{0} != ".")
{
$noOfFiles++;
$Contents[] = $file;
}
}
return @$Contents; }