Spidetra
lundi 27 mars 2006 à 22:36
CITATION(zimounet @ lundi 27 mars 2006, 23h26)
Pas d'exemple, description vague... Pas super complete la doc php sur le coup... Cela ne m'avance pas encore beaucoup, mais merci pour ta contribution

Y a t-il quelqu'un d'autre qui à une idée?
tu pourrais adapter ce bout de code à ton besoin ( source : fct unlink php ) :
CODE
<?php
/**
* rm() -- Vigorously erase files and directories.
*
* _AT_param $fileglob mixed If string, must be a file name (foo.txt), glob pattern (*.txt), or directory name.
* If array, must be an array of file names, glob patterns, or directories.
*/
function rm($fileglob)
{
if (is_string($fileglob)) {
if (is_file($fileglob)) {
return unlink($fileglob);
} else if (is_dir($fileglob)) {
$ok = rm("$fileglob/*");
if (! $ok) {
return false;
}
return rmdir($fileglob);
} else {
$matching = glob($fileglob);
if ($matching === false) {
trigger_error(sprintf('No files match supplied glob %s', $fileglob), E_USER_WARNING);
return false;
}
$rcs = array_map('rm', $matching);
if (in_array(false, $rcs)) {
return false;
}
}
} else if (is_array($fileglob)) {
$rcs = array_map('rm', $fileglob);
if (in_array(false, $rcs)) {
return false;
}
} else {
trigger_error('Param #1 must be filename or glob pattern, or array of filenames or glob patterns', E_USER_ERROR);
return false;
}
return true;
}
?>