title: Delete Directory and directories inside
body: <p>I want to delete a directory and all it's subdirectories.</p>
  
  <pre><code>$folders('users','users/100282','users/100282/test');
  array_map("rmdir",array_reverse($folders));
  </code></pre>
  
  <p>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.</p>
  
  <hr />
  
  <p>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. <strong>How do I fix this?</strong></p>