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 :: Check duplicate email using Jquery validation in laravel 
Php :: disable register laravel 
Php :: eloquent using last() 
Php :: php get client ip 
Php :: alert php 
Php :: php var_dump pre 
Php :: reindex array php 
Php :: php get class name of this 
Php :: php read xml file into array 
Php :: yii2 htpp client form data 
Php :: how to run symfony project 
Php :: wordpress disable editor 
Php :: php sum array elements 
Php :: debug query in moodle 
Php :: mkdir() permission denied laravel 
Php :: strupper 
Php :: shuffle php function 
Php :: php cors 
Php :: check if value is not null in db laravel 
Php :: laravel gigapay get single invoice 
Php :: how create new command in laravel 
Php :: wordpress add submenu 
Php :: php filter name 
Php :: how to check if input is number only in php 
Php :: restcord Guild Icon outputs 404. 
Php :: php loop through months 
Php :: php get random element from array 
Php :: how to change uppercase to lowercase and spaces to _ in php 
Php :: laravel_8 
Php :: get params from url php 
ADD CONTENT
Topic
Content
Source link
Name
2+8 =