Delete Folder and contents

I can’t really find any code that works so it will delete all of the contents(images) in a folder and then delete the folder itself. Does anyone have any working code? I’m new to PHP

use this function
[php]
function rmrf($dir) {
foreach (glob($dir) as $file) {
if (is_dir($file)) {
rmrf("$file/*");
rmdir($file);
} else {
unlink($file);
}
}
}
[/php]

That worked great! Thank you very much!

Sponsor our Newsletter | Privacy Policy | Terms of Service