At 09:36 AM 3/15/2002 +0000, Philip Jeffs wrote:
>Hi,
>
>Does anyone know of an 'easy' way to delete folders that contain files and
>sub-folders?
Here's what I use (use rmdirRf($folderthatcontainsotherstuff)):
<?
function rmdirRf($file) {
if(file_exists($file)) {
chmod($file,0777);
if (is_dir($file)) {
$directory = dir($file);
while(false !== ($filename = $directory->read())) {
if ($filename != "." && $filename != "..") {
rmdirRf($file."/".$filename);
}
}
$directory->close();
rmdir($file);
} else {
unlink($file);
}
}
}
?>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php