Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

rmdir in PHP not working on an empty directory

Tags:

php

I'm trying to remove a directory with PHP.

I unlink/remove all files/subdirs from the inside out and finally call rmdir on the now empty top directory. Everything goes according to plan until the last call to rmdir. PHP warns that the directory is NOT emtpy and refuses to remove it. But when I look at the directory in the explorer it is empty, after all.

I also tried a well known recursive function with the same result.

The operating system is Windows 7 with Xampp and there are no access restrictions for any of the elements in question.

Any ideas?

like image 949
chessweb Avatar asked Feb 23 '23 02:02

chessweb


1 Answers

Can you try this one?

<?php
$handle = opendir($dirpath);
//do whatever you need
closedir($handle)
rmdir($dirpath);
?>
like image 141
Ahmet Kakıcı Avatar answered Mar 08 '23 03:03

Ahmet Kakıcı