protected function removeDots($path)
    {
        $isBeginning = true;

        // If not array, extract it.
        $isArray = is_array($path);

        $path = $isArray ? $path : $this->extract($path);

        // Search for dot files
        foreach ($path as $key => $row) {
            // Remove dot files
            if ($row === '.') {
                unset($path[$key]);
            }

            // Remove dots and go parent dir
            if ($row === '..' && !$isBeginning) {
                unset($path[$key]);
                unset($path[$key - 1]);
            }

            // Do not get parent if dots in the beginning
            if ($row !== '..' && $isBeginning) {
                $isBeginning = false;
            }
        }

        // Re index array
        $path = array_values($path);

        return $isArray ? $path : $this->compact($path);
    }