On Apr 15, 2:28 pm, The Natural Philosopher <a...@b.cwrote:
Quote:
Álvaro G. Vicario wrote:
Quote:
Gordon escribió:
Quote:
I'm trying to remove a directory and all its contents from within a
script. I wrote a recursive function to take care of it, but when I
run it I get random "Directory not empty" error messages.
>
Quote:
In the manual page for unlink() there's a user comment with sample code
for recursive deletion. I haven't tried it but who knows:
>
>
Normally thats because there are hidden or wrong permission files in it.
>
I suspect you need more subtle code, and if in Linux etc, some form of
attention to permissions if these are the problem.
I don't think permissions are the problem, because the development
machine is Windows, and the error message being given is Directory Not
Empty. No Permission Denied errors are popping up in the output. I
also mentioned that the problem went away when I introduced a line of
code for debugging purposes into CmsItem::deleteItem(), which echos
the path being deleted to the output. My suspicion is that the calls
to rmdir are happening more rapidly than the filesystem can cope with
them. The debug code introduced just enough of a delay for the code
to work properly but without it attempts to delete a parent directory
can occur before the deletion of its children has completed, causing
the not empty error.