library/Extlib/FileManager.php
static public function recursiveDelete($path)
    {
        if (is_file($path)) {
            return unlink($path);
        }

        $scans = glob(rtrim($path, '/') . '/*');
        foreach ($scans as $scan) {
            self::recursiveDelete($scan);
        }

        return rmdir($path);
    }
static public function recursiveDelete($path)
    {
        if (is_file($path)) {
            return unlink($path);
        }

        $scans = glob(rtrim($path, '/') . '/*');
        foreach ($scans as $scan) {
            self::recursiveDelete($scan);
        }

        return rmdir($path);
    }
Recursive delete direcotry

@param string $path
@return boolean