Sun Jun 21 2020
Create Delete Directory
PHP Scripting2690 views
File Name: php-create-delete-directory.php
<?php
$dir = "myDirectory";
/* Checking is directory exist or not */
if(!is_dir($dir)) {
/* Create directory with full access permission */
$rs = mkdir($dir,0777) or die("Error...Not able to create directory!");
if($rs == 1)
echo "Directory created successfully!";
}
else
echo "Directory already exist!";
/* Checking is directory exist or not */
if(is_dir($dir)) {
/* Delete directory */
$rs = rmdir($dir) or die("<br />Error...Not able to delete directory!");
if($rs == 1)
echo "<br />Directory deleted successfully!";
}
else
echo "<br />Directory not found!";
?>
/* Output */
Directory created successfully!
Directory deleted successfully!
Author:Geekboots