Storage/src/StreamWrapper.php
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;
    }
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;
    }
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 ; }
Callback handler for trying to move a file or directory.

@param string $from The URL to the current file
@param string $to The URL of the new file location
@return bool
Callback handler for trying to move a file or directory .