public function rename($oldPath, $newPath)
    {
        $old = $this->at($oldPath);
        $new = $this->at($newPath);

        if (null === $old || (null !== $new && 'dir' === $new->type))
            return false;

        if ('file' === $old->type) {
            $this->at($newPath, $old);
        } else {
            if (! $this->mkdir($newPath, $old->perms)) {
                return false;
            }
            $oldPath = $this->realpath($oldPath) . '/';
            $newPath = $this->realpath($newPath) . '/';
            $length = strlen($oldPath);
            foreach (array_keys($this->files) as $childPath) {
                if (substr($childPath, 0, $length) === $oldPath) {
                    $newChildPath = $newPath . substr($childPath, $length);
                    $this->at($newChildPath, $this->at($childPath));
                    $this->at($childPath, null);
                }
            }
        }
        $this->at($oldPath, null);
        return true;
    }
public function rename($oldPath, $newPath)
    {
        $old = $this->at($oldPath);
        $new = $this->at($newPath);

        if (null === $old || (null !== $new && 'dir' === $new->type))
            return false;

        if ('file' === $old->type) {
            $this->at($newPath, $old);
        } else {
            if (! $this->mkdir($newPath, $old->perms)) {
                return false;
            }
            $oldPath = $this->realpath($oldPath) . '/';
            $newPath = $this->realpath($newPath) . '/';
            $length = strlen($oldPath);
            foreach (array_keys($this->files) as $childPath) {
                if (substr($childPath, 0, $length) === $oldPath) {
                    $newChildPath = $newPath . substr($childPath, $length);
                    $this->at($newChildPath, $this->at($childPath));
                    $this->at($childPath, null);
                }
            }
        }
        $this->at($oldPath, null);
        return true;
    }
public function rename ( $ oldPath , $ newPath ) { $ old = $ this -> at ( $ oldPath ) ; $ new = $ this -> at ( $ newPath ) ; if ( null === $ old || ( null !== $ new && 'dir' === $ new -> type ) ) return false ; if ( 'file' === $ old -> type ) { $ this -> at ( $ newPath , $ old ) ; } else { if ( ! $ this -> mkdir ( $ newPath , $ old -> perms ) ) { return false ; } $ oldPath = $ this -> realpath ( $ oldPath ) . '/' ; $ newPath = $ this -> realpath ( $ newPath ) . '/' ; $ length = strlen ( $ oldPath ) ; foreach ( array_keys ( $ this -> files ) as $ childPath ) { if ( substr ( $ childPath , 0 , $ length ) === $ oldPath ) { $ newChildPath = $ newPath . substr ( $ childPath , $ length ) ; $ this -> at ( $ newChildPath , $ this -> at ( $ childPath ) ) ; $ this -> at ( $ childPath , null ) ; } } } $ this -> at ( $ oldPath , null ) ; return true ; }
Equivalent to PHP `rename` function.

@param  string  $path
@return boolean
Equivalent to PHP rename function .