Search
 
SCRIPT & CODE EXAMPLE
 

PHP

php delete a folder

function deleteDirectory($dir) {
    if (!file_exists($dir)) {
        return true;
    }

    if (!is_dir($dir)) {
        return unlink($dir);
    }

    foreach (scandir($dir) as $item) {
        if ($item == '.' || $item == '..') {
            continue;
        }

        if (!deleteDirectory($dir . DIRECTORY_SEPARATOR . $item)) {
            return false;
        }

    }

    return rmdir($dir);
}
Comment

php delete directory

rmdir ( string $dirname , resource $context = ? ) : bool
Comment

PREVIOUS NEXT
Code Example
Php :: laravel collection concat 
Php :: env value return null laravel 
Php :: laravel price database 
Php :: layout.blade.php in laravel 
Php :: laravel make model all with resources api 
Php :: laravel validation array input 
Php :: php get file location 
Php :: permutations php 
Php :: request file create cammand laravel 
Php :: laravel hasmany 
Php :: change arabic number to english php 
Php :: array filter multiple conditions php 
Php :: use resource in laravel 8 
Php :: laravel storage 
Php :: create a new project from cli laravel 
Php :: can I change my ip adress with python 
Php :: phpunit assert not false 
Php :: api response in json laravel 
Php :: laravel-cors 
Php :: how to display the site tagline in wordpress 
Php :: php unserialize array 
Php :: find over array object php find 
Php :: php formData curl 
Php :: Install Older Version of Laravel using Composer 
Php :: eloquent unique combination 
Php :: php online editor 
Php :: lDownload multiple files as a zip-file using php 
Php :: laravel joins eloquent model 
Php :: how to display the database table names list in codeigniter 
Php :: french special characters php 
ADD CONTENT
Topic
Content
Source link
Name
2+2 =