Deleting non empty directory

I assume that you are aware of the rmdir function. This is very useful function, however it has its own limitations. The biggest one is that you are not able to delete non empty folders. We need to build our own function.

First, we will use recursion and second – this actually won’t be a function. We will write a method instead. Of course you may translate it into function, it is very easy (just remove $this->).

Please remember – this is a method, part of the class.

Leave a Reply

Your email address will not be published. Required fields are marked *