53 lines
1.5 KiB
PHP
Executable File
53 lines
1.5 KiB
PHP
Executable File
<?php
|
|
$nomFicAppelant = basename(__FILE__);
|
|
function copierDossier($source , $destination) {
|
|
$debugLocal;
|
|
global $total;
|
|
//
|
|
if (is_dir($source)) {
|
|
$dossier=opendir($source);
|
|
if ($destination=='listeIco1' || $destination=='listeIco2') {return 0;}
|
|
|
|
// @ evite le warnning si dossier exist
|
|
@mkdir($destination, fileperms($source));
|
|
|
|
while ($fichier = readdir($dossier)) {
|
|
$l = array('.', '..');
|
|
if (!in_array( $fichier, $l)) {
|
|
if (isset($debug[1]) && $debug[1] == '1' ) {
|
|
$debugLocal = monDebug (1,[
|
|
'source' => $source. '/' .$fichier,
|
|
'destination/fichier' => $destination. '/' .$fichier,
|
|
],'');
|
|
}
|
|
|
|
if (is_dir($source. "/" .$fichier)) {
|
|
@mkdir($destination, fileperms($source));
|
|
copierDossier("$source/$fichier", "$destination/$fichier");
|
|
}
|
|
else {
|
|
if (!file_exists("$source/$fichier")) {
|
|
echo "<br><strong>❌ Fichier source introuvable :</strong> $source/$fichier";
|
|
}
|
|
else {
|
|
if (!file_exists("$destination/")) {
|
|
echo "<br><strong>❌ Fichier cible introuvable :</strong> $destination/";
|
|
}
|
|
else {
|
|
// echo "<br><strong>✅ Copie :</strong> $source/$fichier → $destination/$fichier";
|
|
copy("$source/$fichier", "$destination/$fichier");
|
|
$total++;
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else {
|
|
$adminMsg .='<br>Pas de src =' .$source;
|
|
}
|
|
|
|
return $total;
|
|
}
|
|
?>
|