title: Codeigniter delete the directory and its contents
body: <p>I am trying to make codeigniter delete a product image folder. </p>
  
  <p>Furthermore, the delete function I am trying to make needs to delete also all of its contents, so empty or not, the folder gets deleted. I'm guessing, it would use a recursive type of deletion...I'm not so sure at all.</p>
  
  <p>I have tried the below functions for deleting :</p>
  
  <pre><code>function delete_directory($path)
  {
      $path=base_url().'products/thumb/';
      $this-&gt;load-&gt;helper("file"); // load the helper
      delete_files($path, true); // delete all files/folders
       //rmdir($dirname);
       if(rmdir($path)){
          echo 'deleted';die;}
       else{
          echo 'not';die; }
       return true;
  
  }
  </code></pre>
  
  <p>But it always returning not</p>