Unlimited directory replication, stationmaster original, although only wrote a few minutes, but still very useful
$o _path= "admin";//Source Directory
$n _path= "n_admin";//New Directory
Class Copy_path
{
function Wm_chief_copypath ($o _path, $n _path)
{$hand =opendir ($o _path);
if (!file_exists ($n _path))//target directory does not exist then establish
{$this->wm_chief_createpath ($n _path);}
$i = 0;
while ($file =readdir ($hand))
{$i;
if ($i ==1| | $i ==2)
{continue;}
if (! ( STRCHR ($file, ".")))
{
$o _s_path= $o _path. " /". $file;
$n _s_path= $n _path. " /". $file;
$this->wm_chief_copypath ($o _s_path, $n _s_path);
}
Else
{
$o _file= $o _path. " /". $file;
$n _file= $n _path. " /". $file;
$this->wm_chief_copyfile ($o _file, $n _file);
}
}
Closedir ($hand);
return true;
}
function Wm_chief_copyfile ($o _file, $n _file)
{
Copy ($o _file, $n _file);
}
function Wm_chief_createpath ($n _path)
{
mkdir ($n _path,0777);
}
}
$WM _chief=new Copy_path ();
$WM _chief_ok= $wm _chief->wm_chief_copypath ($o _path, $n _path);
if ($WM _CHIEF_OK)
{
echo "Copy Complete";
}
?>
http://www.bkjia.com/PHPjc/629774.html www.bkjia.com true http://www.bkjia.com/PHPjc/629774.html techarticle Unlimited directory replication, stationmaster original, although only wrote a few minutes, but still very useful? $o _path=admin;//Source directory $n _path=n_admin;//new directory class Copy_path {function Wm_chi ...