Aşağıda belirtilen kamera klasörünün içinde yer alan klasörleri ve dosyaları php ile silmek istiyorum. Nasıl yapabilirim acaba?

9
●577
function rrmdir($dir) {
if (is_dir($dir)) {
$objects = scandir($dir);
foreach ($objects as $object) {
if ($object != "." && $object != "..") {
if (is_dir($dir."/".$object))
rrmdir($dir."/".$object);
else
unlink($dir."/".$object);
}
}
rmdir($dir);
}
} function rrmdir($dir) {
if (is_dir($dir)) {
$objects = scandir($dir);
foreach ($objects as $object) {
if ($object != "." && $object != "..") {
if (is_dir($dir."kamera".$object))
rrmdir("kamera");
else
unlink($dir."kamera".$object);
}
}
rmdir($dir);
}
}Böyle yaptım ama silmedi
function deleteDir($dirPath) {
if (substr($dirPath, strlen($dirPath) - 1, 1) != '/') {
$dirPath .= '/';
}
$files = glob($dirPath . '*', GLOB_MARK);
foreach ($files as $file) {
if (is_dir($file)) {
deleteDir($file);
} else {
unlink($file);
}
}
rmdir($dirPath);
}deleteDir("kamera");function deleteDir($dirPath) {
if (substr($dirPath, strlen($dirPath) - 1, 1) != '/') {
$dirPath .= '/';
}
$files = glob($dirPath . '*', GLOB_MARK);
foreach ($files as $file) {
if (is_dir($file)) {
deleteDir("kamera");
} else {
unlink($file);
}
}
rmdir($dirPath);
}Bu şekilde yaptım silmedi yine hocam