rmdir (Remove directory) in php

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.
<?php
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);}}
reset
($objects);
rmdir
($dir);}}
?>

Hope it will be helpful for you guys.

Post a Comment

Post a Comment (0)

Previous Post Next Post