code show as below:
function deldir ($ dir)
{
if ($ handle = opendir ($ dir))
{
while (false! == ($ file = readdir ($ handle)))
{
if ($ file! = "."&&$ file! = "..")
{
$ fullpath = $ dir. "/". $ file;
// echo "full path: $ fullpath <br>";
if (is_dir ($ fullpath))
{
deldir ($ fullpath);
}
}
}
echo "to del file: $ dir <br>";
rmdir ($ dir);
closedir ($ handle);
}
}
delfile ($ dir);
deldir ($ dir);
The problems occurred as follows:
to del file: D: / AppServ / www / hy / html / 107/1/2
Warning: rmdir (D: / AppServ / www / hy / html / 107/1/2) [function.rmdir]: Permission denied in D:\AppServ\www\hy\del.php on line 48
to del file: D: / AppServ / www / hy / html / 107/1/3
Warning: rmdir (D: / AppServ / www / hy / html / 107/1/3) [function.rmdir]: Permission denied in D:\AppServ\www\hy\del.php on line 48
to del file: D: / AppServ / www / hy / html / 107/1/4
Warning: rmdir (D: / AppServ / www / hy / html / 107/1/4) [function.rmdir]: Permission denied in D:\AppServ\www\hy\del.php on line 48
to del file: D: / AppServ / www / hy / html / 107/1/5
Warning: rmdir (D: / AppServ / www / hy / html / 107/1/5) [function.rmdir]: Permission denied in D:\AppServ\www\hy\del.php on line 48
to del file: D: / AppServ / www / hy / html / 107/1/6
Warning: rmdir (D: / AppServ / www / hy / html / 107/1/6) [function.rmdir]: Permission denied in D:\AppServ\www\hy\del.php on line 48
to del file: D: / AppServ / www / hy / html / 107/1/7
Warning: rmdir (D: / AppServ / www / hy / html / 107/1/7) [function.rmdir]: Permission denied in D:\AppServ\www\hy\del.php on line 48
to del file: D: / AppServ / www / hy / html / 107/1
Warning: rmdir (D: / AppServ / www / hy / html / 107/1) [function.rmdir]: Permission denied in D:\AppServ\www\hy\del.php on line 48
to del file: D: / AppServ / www / hy / html / 107/2
Warning: rmdir (D: / AppServ / www / hy / html / 107/2) [function.rmdir]: Permission denied in D:\AppServ\www\hy\del.php on line 48
to del file: D: / AppServ / www / hy / html / 107
Warning: rmdir (D: / AppServ / www / hy / html / 107) [function.rmdir]: Permission denied in D:\AppServ\www\hy\del.php on line 48
to del file: D: / AppServ / www / hy / html / yuiop
Warning: rmdir (D: / AppServ / www / hy / html / yuiop) [function.rmdir]: Permission denied in D:\AppServ\www\hy\del.php on line 48
to del file: D: / AppServ / www / hy / html
Warning: rmdir (D: / AppServ / www / hy / html) [function.rmdir]: Permission denied in D:\AppServ\www\hy\del.php on line 48
The directory is right (also empty) but it can't be deleted
Hope advice
I would like to ask how to check the permissions
If it is a permission issue, why is my rmdir ("D: / AppServ / www / hy / html / 107/1/3") successful? ?
sorry did not pay attention to that you are running under the window, you can see if your deleted directory exists D: / AppServ / www / hy / html / 107, in addition, if there is a subdirectory in 107, can it be deleted
Is it a permission issue? Why the following code is successful, note that the last is to directly delete
// Delete the specified directory
function deldir ($ dir)
{
if ($ handle = opendir ($ dir))
{
while (false! == ($ file = readdir ($ handle)))
{
if ($ file! = "."&&$ file! = "..")
{
$ fullpath = $ dir. "/". $ file;
// echo "full path: $ fullpath <br>";
if (is_dir ($ fullpath))
{
deldir ($ fullpath);
}
}
}
echo "to del file: $ dir <br>";
rmdir ($ dir);
closedir ($ handle);
}
}
/ ** ///
delfile ($ dir);
deldir ($ dir);
echo "direct to delete file: D: / AppServ / www / hy / html / 107/1/5 <br>";
if (rmdir ("D: / AppServ / www / hy / html / 107/1/5"))
{
echo "delete succeed";
}
else
{
echo "delete failed";
}
to del file: D: / AppServ / www / hy / html / 107/1/4
Warning: rmdir (D: / AppServ / www / hy / html / 107/1/4) [function.rmdir]: Permission denied in D:\AppServ\www\hy\del.php on line 48
to del file: D: / AppServ / www / hy / html / 107/1/5
Warning: rmdir (D: / AppServ / www / hy / html / 107/1/5) [function.rmdir]: Permission denied in D:\AppServ\www\hy\del.php on line 48
to del file: D: / AppServ / www / hy / html / 107/1/6
Warning: rmdir (D: / AppServ / www / hy / html / 107/1/6) [function.rmdir]: Permission denied in D:\AppServ\www\hy\del.php on line 48
to del file: D: / AppServ / www / hy / html / 107/1/7
Warning: rmdir (D: / AppServ / www / hy / html / 107/1/7) [function.rmdir]: Permission denied in D:\AppServ\www\hy\del.php on line 48
to del file: D: / AppServ / www / hy / html / 107/1
Warning: rmdir (D: / AppServ / www / hy / html / 107/1) [function.rmdir]: Permission denied in D:\AppServ\www\hy\del.php on line 48
to del file: D: / AppServ / www / hy / html / 107/2
Warning: rmdir (D: / AppServ / www / hy / html / 107/2) [function.rmdir]: Permission denied in D:\AppServ\www\hy\del.php on line 48
to del file: D: / AppServ / www / hy / html / 107
Warning: rmdir (D: / AppServ / www / hy / html / 107) [function.rmdir]: Permission denied in D:\AppServ\www\hy\del.php on line 48
to del file: D: / AppServ / www / hy / html / yuiop
Warning: rmdir (D: / AppServ / www / hy / html / yuiop) [function.rmdir]: Permission denied in D:\AppServ\www\hy\del.php on line 48
to del file: D: / AppServ / www / hy / html
Warning: rmdir (D: / AppServ / www / hy / html) [function.rmdir]: Permission denied in D:\AppServ\www\hy\del.php on line 48
direct to delete file: D: / AppServ / www / hy / html / 107/1/5
delete succeed
It can be seen that the deletion is successful I check the folder is indeed gone
Can you explain to the prawns?