concrete/src/File/Service/File.php
public function removeAll($source, $inc = false)
    {
        if (!is_dir($source)) {
            return false;
        }

        $iterator = new \RecursiveIteratorIterator(
            new \RecursiveDirectoryIterator($source, \FilesystemIterator::SKIP_DOTS),
            \RecursiveIteratorIterator::CHILD_FIRST
        );

        foreach ($iterator as $path) {
            if ($path->isDir()) {
                if (!@rmdir($path->__toString())) {
                    return false;
                }
            } else {
                if (!@unlink($path->__toString())) {
                    return false;
                }
            }
        }
        if ($inc) {
            if (!@rmdir($source)) {
                return false;
            }
        }

        return true;
    }
public function removeAll($source, $inc = false)
    {
        if (!is_dir($source)) {
            return false;
        }

        $iterator = new \RecursiveIteratorIterator(
            new \RecursiveDirectoryIterator($source, \FilesystemIterator::SKIP_DOTS),
            \RecursiveIteratorIterator::CHILD_FIRST
        );

        foreach ($iterator as $path) {
            if ($path->isDir()) {
                if (!@rmdir($path->__toString())) {
                    return false;
                }
            } else {
                if (!@unlink($path->__toString())) {
                    return false;
                }
            }
        }
        if ($inc) {
            if (!@rmdir($source)) {
                return false;
            }
        }

        return true;
    }
public function removeAll ( $ source , $ inc = false ) { if ( ! is_dir ( $ source ) ) { return false ; } $ iterator = new \ RecursiveIteratorIterator ( new \ RecursiveDirectoryIterator ( $ source , \ FilesystemIterator :: SKIP_DOTS ) , \ RecursiveIteratorIterator :: CHILD_FIRST ) ; foreach ( $ iterator as $ path ) { if ( $ path -> isDir ( ) ) { if ( ! @ rmdir ( $ path -> __toString ( ) ) ) { return false ; } } else { if ( ! @ unlink ( $ path -> __toString ( ) ) ) { return false ; } } } if ( $ inc ) { if ( ! @ rmdir ( $ source ) ) { return false ; } } return true ; }
Removes all files from within a specified directory.

@param string $source Directory
@param bool   $inc    Remove the passed directory as well or leave it alone

@return bool Whether the methods succeeds or fails
Removes all files from within a specified directory .