private function rmdir($path) { foreach (glob($path . '/*') as $file) { if (is_dir($file)) { $this->rmdir($file); } else { unlink($file); } } rmdir($path); }