public function rename($path_from, $path_to) {
    $this->initializeObjectStorage();
    $src = $this->parseUrl($path_from);
    $dest = $this->parseUrl($path_to);

    if ($src['scheme'] != $dest['scheme']) {
      trigger_error("I'm too stupid to copy across protocols.", E_USER_WARNING);
    }

    if ( empty($src['host'])  || empty($src['path'])
      || empty($dest['host']) || empty($dest['path'])) {
        trigger_error('Container and path are required for both source and destination URLs.', E_USER_WARNING);
        return FALSE;
    }

    try {
      $container = $this->store->container($src['host']);

      $object = $container->remoteObject($src['path']);

      $ret = $container->copy($object, $dest['path'], $dest['host']);
      if ($ret) {
        return $container->delete($src['path']);
      }
    }
    catch (\HPCloud\Exception $e) {
      trigger_error('Rename was not completed: ' . $e->getMessage(), E_USER_WARNING);
      return FALSE;
    }
  }
public function rename($path_from, $path_to) {
    $this->initializeObjectStorage();
    $src = $this->parseUrl($path_from);
    $dest = $this->parseUrl($path_to);

    if ($src['scheme'] != $dest['scheme']) {
      trigger_error("I'm too stupid to copy across protocols.", E_USER_WARNING);
    }

    if ( empty($src['host'])  || empty($src['path'])
      || empty($dest['host']) || empty($dest['path'])) {
        trigger_error('Container and path are required for both source and destination URLs.', E_USER_WARNING);
        return FALSE;
    }

    try {
      $container = $this->store->container($src['host']);

      $object = $container->remoteObject($src['path']);

      $ret = $container->copy($object, $dest['path'], $dest['host']);
      if ($ret) {
        return $container->delete($src['path']);
      }
    }
    catch (\HPCloud\Exception $e) {
      trigger_error('Rename was not completed: ' . $e->getMessage(), E_USER_WARNING);
      return FALSE;
    }
  }
public function rename ( $ path_from , $ path_to ) { $ this -> initializeObjectStorage ( ) ; $ src = $ this -> parseUrl ( $ path_from ) ; $ dest = $ this -> parseUrl ( $ path_to ) ; if ( $ src [ 'scheme' ] != $ dest [ 'scheme' ] ) { trigger_error ( "I'm too stupid to copy across protocols." , E_USER_WARNING ) ; } if ( empty ( $ src [ 'host' ] ) || empty ( $ src [ 'path' ] ) || empty ( $ dest [ 'host' ] ) || empty ( $ dest [ 'path' ] ) ) { trigger_error ( 'Container and path are required for both source and destination URLs.' , E_USER_WARNING ) ; return FALSE ; } try { $ container = $ this -> store -> container ( $ src [ 'host' ] ) ; $ object = $ container -> remoteObject ( $ src [ 'path' ] ) ; $ ret = $ container -> copy ( $ object , $ dest [ 'path' ] , $ dest [ 'host' ] ) ; if ( $ ret ) { return $ container -> delete ( $ src [ 'path' ] ) ; } } catch ( \ HPCloud \ Exception $ e ) { trigger_error ( 'Rename was not completed: ' . $ e -> getMessage ( ) , E_USER_WARNING ) ; return FALSE ; } }
Rename a swift object.

This works by copying the object (metadata) and
then removing the original version.

This DOES support cross-container renaming.

See Container::copy().

@code
<?php
Bootstrap::setConfiguration(array(
'tenantname' => 'foo@example.com',
// 'tenantid' => '1234', // You can use this instead of tenantname
'account' => '1234',
'secret' => '4321',
'endpoint' => 'https://auth.example.com',
));

$from = 'swift://containerOne/file.txt';
$to = 'swift://containerTwo/file.txt';

// Rename can also take a context as a third param.
rename($from, $to);

?>
@endcode

@param string $path_from
A swift URL that exists on the remote.
@param string $path_to
A swift URL to another path.
@retval boolean
@return boolean
TRUE on success, FALSE otherwise.
Rename a swift object .