source/Setup/Utilities.php
public function removeDir($sPath, $blDeleteSuccess, $iMode = 0, $aSkipFiles = [], $aSkipFolders = [])
    {

        if (is_file($sPath) || is_dir($sPath)) {
            // setting path to remove
            $d = dir($sPath);
            $d->handle;
            while (false !== ($sEntry = $d->read())) {
                if ($sEntry != "." && $sEntry != "..") {
                    $sFilePath = $sPath . "/" . $sEntry;
                    if (is_file($sFilePath)) {
                        if (!in_array(basename($sFilePath), $aSkipFiles)) {
                            $blDeleteSuccess = $blDeleteSuccess * @unlink($sFilePath);
                        }
                    } elseif (is_dir($sFilePath)) {
                        // removing direcotry contents
                        $this->removeDir($sFilePath, $blDeleteSuccess, $iMode, $aSkipFiles, $aSkipFolders);
                        if ($iMode === 0 && !in_array(basename($sFilePath), $aSkipFolders)) {
                            $blDeleteSuccess = $blDeleteSuccess * @rmdir($sFilePath);
                        }
                    } else {
                        // there are some other objects ?
                        $blDeleteSuccess = $blDeleteSuccess * false;
                    }
                }
            }
            $d->close();
        } else {
            $blDeleteSuccess = false;
        }

        return $blDeleteSuccess;
    }
public function removeDir($sPath, $blDeleteSuccess, $iMode = 0, $aSkipFiles = [], $aSkipFolders = [])
    {

        if (is_file($sPath) || is_dir($sPath)) {
            // setting path to remove
            $d = dir($sPath);
            $d->handle;
            while (false !== ($sEntry = $d->read())) {
                if ($sEntry != "." && $sEntry != "..") {
                    $sFilePath = $sPath . "/" . $sEntry;
                    if (is_file($sFilePath)) {
                        if (!in_array(basename($sFilePath), $aSkipFiles)) {
                            $blDeleteSuccess = $blDeleteSuccess * @unlink($sFilePath);
                        }
                    } elseif (is_dir($sFilePath)) {
                        // removing direcotry contents
                        $this->removeDir($sFilePath, $blDeleteSuccess, $iMode, $aSkipFiles, $aSkipFolders);
                        if ($iMode === 0 && !in_array(basename($sFilePath), $aSkipFolders)) {
                            $blDeleteSuccess = $blDeleteSuccess * @rmdir($sFilePath);
                        }
                    } else {
                        // there are some other objects ?
                        $blDeleteSuccess = $blDeleteSuccess * false;
                    }
                }
            }
            $d->close();
        } else {
            $blDeleteSuccess = false;
        }

        return $blDeleteSuccess;
    }
public function removeDir ( $ sPath , $ blDeleteSuccess , $ iMode = 0 , $ aSkipFiles = [ ] , $ aSkipFolders = [ ] ) { if ( is_file ( $ sPath ) || is_dir ( $ sPath ) ) { // setting path to remove $ d = dir ( $ sPath ) ; $ d -> handle ; while ( false !== ( $ sEntry = $ d -> read ( ) ) ) { if ( $ sEntry != "." && $ sEntry != ".." ) { $ sFilePath = $ sPath . "/" . $ sEntry ; if ( is_file ( $ sFilePath ) ) { if ( ! in_array ( basename ( $ sFilePath ) , $ aSkipFiles ) ) { $ blDeleteSuccess = $ blDeleteSuccess * @ unlink ( $ sFilePath ) ; } } elseif ( is_dir ( $ sFilePath ) ) { // removing direcotry contents $ this -> removeDir ( $ sFilePath , $ blDeleteSuccess , $ iMode , $ aSkipFiles , $ aSkipFolders ) ; if ( $ iMode === 0 && ! in_array ( basename ( $ sFilePath ) , $ aSkipFolders ) ) { $ blDeleteSuccess = $ blDeleteSuccess * @ rmdir ( $ sFilePath ) ; } } else { // there are some other objects ? $ blDeleteSuccess = $ blDeleteSuccess * false ; } } } $ d -> close ( ) ; } else { $ blDeleteSuccess = false ; } return $ blDeleteSuccess ; }
Recursively removes given path files and folders

@param string $sPath           path to remove
@param bool   $blDeleteSuccess removal state marker
@param int    $iMode           remove mode: 0 files and folders, 1 - files only
@param array  $aSkipFiles      files which should not be deleted (default null)
@param array  $aSkipFolders    folders which should not be deleted (default null)

@return bool
Recursively removes given path files and folders