public static function purge($path, $fileFilterRegex = null, $dirFilterRegex = null)
    {
        Path::validatePath($path);

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

        foreach ((array) $fileFilterRegex as $regex) {
            $iterator = new FileRegexIterator($iterator, $regex);
        }

        foreach ((array) $dirFilterRegex as $regex) {
            $iterator = new DirectoryRegexIterator($iterator, $regex);
        }

        foreach ($iterator as $file) {
            if ($file->isDir()) {
                Path::delete($file->getPathName());
                continue;
            }
            File::delete($file->getPathname());
        }
    }
public static function purge($path, $fileFilterRegex = null, $dirFilterRegex = null)
    {
        Path::validatePath($path);

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

        foreach ((array) $fileFilterRegex as $regex) {
            $iterator = new FileRegexIterator($iterator, $regex);
        }

        foreach ((array) $dirFilterRegex as $regex) {
            $iterator = new DirectoryRegexIterator($iterator, $regex);
        }

        foreach ($iterator as $file) {
            if ($file->isDir()) {
                Path::delete($file->getPathName());
                continue;
            }
            File::delete($file->getPathname());
        }
    }
public static function purge ( $ path , $ fileFilterRegex = null , $ dirFilterRegex = null ) { Path :: validatePath ( $ path ) ; $ iterator = new RecursiveDirectoryIterator ( $ path , FilesystemIterator :: SKIP_DOTS ) ; $ iterator = new RecursiveIteratorIterator ( $ iterator , RecursiveIteratorIterator :: CHILD_FIRST ) ; foreach ( ( array ) $ fileFilterRegex as $ regex ) { $ iterator = new FileRegexIterator ( $ iterator , $ regex ) ; } foreach ( ( array ) $ dirFilterRegex as $ regex ) { $ iterator = new DirectoryRegexIterator ( $ iterator , $ regex ) ; } foreach ( $ iterator as $ file ) { if ( $ file -> isDir ( ) ) { Path :: delete ( $ file -> getPathName ( ) ) ; continue ; } File :: delete ( $ file -> getPathname ( ) ) ; } }
Delete directory content.

@param string       $path
@param string|array $fileFilterRegex [optional] Regex of files to purge (can be negated to skip files)
@param string|array $dirFilterRegex  [optional] Regex of dirs to purge (can be negated to skip dirs)
Delete directory content .