This problem came up where I needed to remove a folder. Removing a folder is easy, only the PHP command rmdir() only removes the folder if it is empty. The PHP command unlink() is only for files.
So how do I recursively delete a folder that might not be empty? Here is a function for you:Then just call it with the non-empty folder you want to remove.