note 52355 deleted from function.mkdir by crell
| From: | crell@php.net | Date: | Wed, 29 Jun 2022 19:18:43 +0000 |
| Subject: | note 52355 deleted from function.mkdir by crell | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-218717@lists.php.net to get a copy of this message | ||
Note Submitter: webmaster2007 at home dot nl
----
Maybe you can use this:
<?php
function open_dir($dir, $newdir){ //The function that will copy the files
if(file_exists($dir) && file_exists($newdir)){
$open_dir=opendir($dir);
while (false !== ($file = readdir($open_dir))) {
if($file != "." && $file != ".."){
if(file_exists($newdir."/".$file) &&
filetype($newdir."/".$file."/") != "dir"){
unlink($newdir."/".$file);
}
if(filetype($dir."/".$file."/") == "dir"){
if(!file_exists($newdir."/".$file."/")){
mkdir($newdir."/".$file."/");
open_dir($dir."/".$file."/", $newdir."/".$file."/");
}
}
else {
copy($dir."/".$file."/", $newdir."/".$file);
}
}
}
}
}
open_dir("Your source map", "Your destination map"); //Here you can fill in
your source en destination map
?>