rmdir (Remove directory) in php

Niyaz Ahamed Jamal

rmdir (Remove directory) is a  function in php. which is very useful in projects. sometimes when we try to remove files from server and localhost somewhat issues will be occurred even though we pass correct values with right functions, This things major on making directories and deleting directories.

so use the following simple php script for remove directories.

  function rrmdir($dir){if(is_dir($dir)){
    $objects = scandir($dir);foreach($objects as $object){if($object !="."&& $object !=".."){if(filetype($dir."/".$object)=="dir") 
           rrmdir($dir."/".$object);else unlink   ($dir."/".$object);}}

Hope it will be helpful for you guys.

View original post