Coding standards
Security in ResourceSpace
Developer reference
Database
Action functions
Admin functions
Ajax functions
Annotation functions
API functions
Collections functions
Comment functions
Config functions
CSV export functions
Dash functions
Debug functions
Encryption functions
Facial recognition functions
File functions
General functions
Language functions
Log functions
Login functions
Message functions
Migration functions
Node functions
PDF functions
Plugin functions
Render functions
Reporting functions
Request functions
Research functions
Slideshow functions
Theme permission functions
User functions
Video functions
Database functions
Metadata functions
Resource functions
Search functions
Map functions
Job functions
Tab functions
Test functions

rrmdir()

Description

Recursively remove a folder and its contents. Paths to ignore can be specified.

Parameters

ColumnTypeDefaultDescription
$dir string The folder to delete.
$ignore_dirs array array An optional array of folders to ignore.

Return

null

Location

include/file_functions.php lines 210 to 234

Definition

 
function rrmdir($dir,$ignore_dirs=array())
    { 
    if (
is_dir($dir))
        { 
        
$objects scandir($dir);
        foreach (
$objects as $object)
            { 
            if (
$object != "." && $object != "..")
                { 
                if (
is_dir($dir"/" .$object) && !is_link($dir."/".$object))
                    {
                    
rrmdir($dir"/" .$object,$ignore_dirs);
                    }
                else
                    {
                    
unlink($dir"/" .$object); 
                    }
                } 
            }
        if (!
in_array($dir,$ignore_dirs))
            {
            
debug("system_reset: remove directory " $dir);
            }
        }
    }

This article was last updated 11th April 2022 10:05 Europe/London time based on the source file dated 11th April 2022 09:55 Europe/London time.