Removing directory using codeigniter
You can delete all files using delete_files function
$path=$this->config->base_url().'dir_name';
$this->load->helper("file"); // load the helper
delete_files($path, true); // delete all files/folders
Above code will delete all files and folders from the given path and if once the directory is empty then you can use rmdir which deletes an empty directory, like
rmdir($path);
The folder should permit relevant permissions, which means files/folder must be writable or owned by the system in order to be deleted.