public function rename($from, $to)
    {
        $url = (array) parse_url($to) + [
            'path' => '',
            'host' => ''
        ];

        $destinationBucket = $url['host'];
        $destinationPath = substr($url['path'], 1);

        $this->dir_opendir($from, []);
        foreach ($this->directoryIterator as $file) {
            $name = $file->name();
            $newPath = str_replace($this->file, $destinationPath, $name);

            $obj = $this->bucket->object($name);
            try {
                $obj->rename($newPath, ['destinationBucket' => $destinationBucket]);
            } catch (ServiceException $e) {
                // If any rename calls fail, abort and return false
                return false;
            }
        }
        return true;
    }