Possible Duplicate:
How do I recursively delete a directory and its entire contents (files+sub dirs) in PHP?
I need to recursively delete a directory and subdirectories that aren't empty. I can't find any useful class or function to solve this problem.
In advance thanks for your answers.
From the first comment in the official documentation.
Edited rmdir to rrmdir to correct typo from obvious intent to create recursive function.
Something like this should do it...
This deletes all child files and folders and then removes the top level folder passed to it.
It could do with some error checking such as testing the path supplied is a directory and making sure each deletion was successful.
To recursively delete a directory use this:
Only tested on unix.