Delete an empty directory called dir1 : Directory Create Delete « File Directory « PHP






Delete an empty directory called dir1

 
<?php
   $dir_delete = "/home/fake/dir1";
   
   if (rmdir ($dir_delete)) {
         echo "Directory deleted successfully.", "\n";
   }else {
         echo "Could not delete the directory.", "\n";
   }
?>



           
       








Related examples in the same category

1.Creating and Destroying a Directory Handle
2.Deleting a Directory by Using rmdir()