note 36381 modified in function.copy by vrana
| From: | vrana@php.net | Date: | Tue, 17 Aug 2004 14:55:25 +0000 |
| Subject: | note 36381 modified in function.copy by vrana | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-79977@lists.php.net to get a copy of this message | ||
<?php
$source="test";
$dest="test/php";
//see if (is_dir("$source/$entry")&&$dest!=="$source/$entry")
copys($source,$dest);
function copys($source,$dest)
{
if (!is_dir($source))
return 0;
if (!is_dir($dest))
{
mkdirs($dest);
}
$h=@dir($source);
while (@($entry=$h->read()) !== false)
{
if (($entry!=".")&&($entry!=".."))
{
if (is_dir("$source/$entry")&&$dest!=="$source/$entry")
{
copys("$source/$entry","$dest/$entry");
}
else
{
@copy("$source/$entry","$dest/$entry");
}
}
}
$h->close();
return 1;
}
?>
--was--
$source="test";
$dest="test/php";
//see if (is_dir("$source/$entry")&&$dest!=="$source/$entry")
copys($source,$dest);
function copys($source,$dest)
{
if (!is_dir($source))
return 0;
if (!is_dir($dest))
{
mkdirs($dest);
}
$h=@dir($source);
while (@($entry=$h->read()) !== false)
{
if (($entry!=".")&&($entry!=".."))
{
if (is_dir("$source/$entry")&&$dest!=="$source/$entry")
{
copys("$source/$entry","$dest/$entry");
}
else
{
@copy("$source/$entry","$dest/$entry");
}
}
}
$h->close();
return 1;
}
http://php.net/manual/en/function.copy.php