Reputation: 1374
When I try to delete empty directory I got the following warnings for on line 93
and on line 99
:
Warning: unlink(/data/sites/web/xxx/www/uploads/file/2021-04-02/.nfs0000000059f70c14000017a9): Device or resource busy in /data/sites/web/xxx/www/dreq/req.php on line 93
Warning: rmdir(/data/sites/web/xxx/www/uploads/file/2021-04-02): Directory not empty in /data/sites/web/xxx/www/dreq/req.php on line 99
here is the delete function :
function rrmdir($src) {
$dir = opendir($src);
while(false !== ( $file = readdir($dir)) ) {
if (( $file != '.' ) && ( $file != '..' )) {
$full = $src . '/' . $file;
if ( is_dir($full) ) {
rrmdir($full); // On line 93
}
else {
unlink($full);
}
}
}
closedir($dir);
rmdir($src); // On line 99
}
What is the issue here?
Upvotes: 1
Views: 121
Reputation: 28564
Issue 1. Check which process hold that file with lsof -f | grep filename
to check which process hold that resource.
Issue 2. Check the manual rmdir, the directory must be empty.
Attempts to remove the directory named by dirname. The directory must be empty, and the relevant permissions must permit this. A E_WARNING level error will be generated on failure.
Refer to this to has a view on where the hidden nfs file comes from
Upvotes: 2