The rmdir() function fails if the folder contains any files. I can loop through all of the the files in the directory with something like this:
rmdir()
function delete_files($dir) { if (is_dir($dir)) { $objects = scandir($dir); foreach ($objects as $object) { if ($object != "." && $object != "..") { if (filetype($dir."/".$object) == "dir") delete_files($dir."/".$object); else unlink ($dir."/".$object); } } reset($objects); rmdir($dir); } }