I want to delete a directory and all it's subdirectories.
$folders('users','users/100282','users/100282/test');
array_map("rmdir",array_reverse($folders));
Unfortunately this doesn't work. I get 2 errors saying that the directory is not empty. If i refresh, only 1 error, if I refresh once more, no more errors.
What's happening is that the script attempts to remove the parent directory before the previous task is ececuted, which renders the folder non-empty. How do I fix this?