> [snip]
> When the script tries to delete a file, we always check (using
> file_exists) to see whether the file exists before it's deleted.
>
> The check comes back true, but the unlink then fails, saying no file or
> directory there!
> [/snip]
>
> Could you please post the code you are using to check and unlink the
> file?
Heres the function - sometimes the scandir fails, sometimes the unlink,
sometimes the rmdir at the end. They all have @ to try and surpress the
error, but I think it's a system halt failure - I can only assume?
You'll also see there are quite a lot of clearstatcache - that was another
attempt to sort this problem out!
function system_rmdir($dir) {
$current_error_level = error_level();
error_reporting(0);
$dir = $dir."/";
$dir=str_replace("//", "/", $dir);
clearstatcache();
if (is_dir($dir)) {
$dir_contents = scandir($dir);
foreach ($dir_contents as $item) {
clearstatcache();
if (is_dir($dir.$item) && $item != '.' && $item !=
'..') {
system_rmdir($dir.$item.'/');
} elseif (file_exists($dir.$item) && $item != '.' &&
$item != '..') {
@unlink($dir.$item);
}
}
clearstatcache();
if (is_dir($dir)) {
@rmdir($dir);
}
}
error_reporting($current_error_level);
}
Thanks
Nunners
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php