kbjradmin
New Member
- Messages
- 512
- Reaction score
- 2
- Points
- 0
I am using the following PHP function to recursively delete directories:
The unlink() call is returning false (i tested it by wrapping it in a var_dump() call), but the file is not being deleted. I really have no idea what is wrong here. Help?
PHP:
class Classname{
//...
public function rmdir($dir) {
if (is_dir($dir)) {
$objects = scandir($dir);
foreach ($objects as $object) {
if ($object != "." && $object != "..") {
chmod("$dir/$object", 0777);
if (filetype("$dir/$object") == "dir")
$this->rmdir("$dir/$object");
else unlink("$dir/$object");
}
}
reset($objects);
rmdir($dir);
}
}
//...
}