rename a file or directory
@param        $from
@param        $to
@param string $type
@return mixed
557641
public function move($from, $to, $type='sandbox')
	{
		$url = 'https://api.dropbox.com/1/fileops/move';
		$params = array('from_path' => $from,'to_path'=>$to);
		$result = $this->doOAuthCall($url, 'POST', $params, $type);
		$result_body = json_decode($result['body'], true);
		if (!array_key_exists('error', $result_body)) {
			return $result_body;
		} else {
			trigger_error(sprintf(self::E_APIERROR, $result_body['error']));
			return false;
		}
	}
1259861
protected function sameFilesystemAction(
        /*# string */ $from,
        /*# string */ $to,
        /*# string */ $action = 'copy'
    )/*# : bool */ {
        $obj = $this->path($from);
        $res = $obj->{$action}($this->path($to)->getPath());
        $this->copyError($obj);
        return $res;
    }
1040394
public function renameRemoteFile($from, $to)
    {
        if(@ssh2_sftp_rename($this->sftp, $from, $to)){
            throw new \Exception("Could not rename file from $from to $to");
        }

        return true;
    }
1164455
protected function publishDirectory($from, $to)
    {
        $manager = new MountManager([
            'from' => new Flysystem(new LocalAdapter($from)),
            'to' => new Flysystem(new LocalAdapter($to)),
        ]);

        foreach ($manager->listContents('from://', true) as $file) {
            if ($file['type'] === 'file' && (!$manager->has('to://' . $file['path']) || $this->option('force'))) {
                $manager->put('to://' . $file['path'], $manager->read('from://' . $file['path']));
            }
        }

        $this->status($from, $to, 'Directory');
    }
177926
public function rename($from, $to) {
		return $this->getState()->rename($this->buildUrl($from), $this->buildUrl($to));
	}
1224902
function RenameFile($type, $dir, $filename, $newname)
    {
        $dir = $this->AccessDir($dir, $type);
        if (!$dir)
        {
            return false;
        }

        $filename = trim($filename);

        if (empty($filename))
        {
            return 'error';
        }

        if (!is_dir($dir . '/.thumbs'))
        {
            return 'error';
        }

        $dbfile = $dir . '/.thumbs/.db';
        if (is_file($dbfile))
        {
            $dbfilehandle = fopen($dbfile, "r");
            $dblength = filesize($dbfile);
            if ($dblength > 0)
            {
                $dbdata = fread($dbfilehandle, $dblength);
            }
            else
            {
                $dbdata = '';
            }
            fclose($dbfilehandle);
        }
        else
        {
            return 'error';
        }

        $files = unserialize($dbdata);

        foreach ($files as $file => $fdata)
        {
            if ($file == $filename)
            {
                $files[$file]['general']['name'] = $newname;
                break;
            }
        }

        $dbfilehandle = fopen($dbfile, "w");
        fwrite($dbfilehandle, serialize($files));
        fclose($dbfilehandle);

        return 'ok';
    }
366409
public function moveDirectory( $from, $to, $overwrite = false )
	{
		if ( $overwrite && $this->isDirectory( $to ) )
		{
			$this->deleteDirectory( $to );

			$this->copyDirectory( $from, $to );

			$this->deleteDirectory( $from );

			return true;
		}

		return @rename( $from, $to ) === true;
	}
264807
public function rename($to) {
		
		if($this->alreadyUploaded) {
			return parent::rename($to);
		}

		$this->originalName = $to;

		return $this;

	}
359003
protected function replace($from, $to)
    {
        if ($this->file->getExtension() === 'json') {
            $from = addslashes($from);
        }

        file_put_contents(
            $this->file->getRealPath(),
            str_replace($from, $to, $this->file->getContents())
        );
    }
1186026
public function copy($from, $to, $fromCopyRef = null)
    {
        $call = 'fileops/copy';
        $params = array(
            'root' => $this->root,
            'from_path' => $this->normalisePath($from),
            'to_path' => $this->normalisePath($to),
        );
        
        if ($fromCopyRef) {
            $params['from_path'] = null;
            $params['from_copy_ref'] = $fromCopyRef;
        }
        
        $response = $this->fetch('POST', self::API_URL, $call, $params);
        return $response;
    }
376857
public function rename($from, $to) {
		$path1 = $this->escapePath($from);
		$path2 = $this->escapePath($to);
		$output = $this->execute('rename ' . $path1 . ' ' . $path2);
		return $this->parseOutput($output, $to);
	}
483696
public static void rename(String from, String to) {
        try {
            Files.move(Paths.get(from), Paths.get(to), StandardCopyOption.REPLACE_EXISTING);
        } catch (IOException e) {
            log.error("Error renaming file", e);
        }
    }
847645
protected function renameCacheEntries($to) {

		if(($cachePath = $this->folder->getCachePath(TRUE))) {

			$di	= new \DirectoryIterator($cachePath);

			foreach($di as $fileinfo) {

				$filename = $fileinfo->getFilename();

				if(	$fileinfo->isDot() ||
					!$fileinfo->isFile() ||
					strpos($filename, $this->filename) !== 0
				) {
					continue;
				}

				$renamed = substr_replace($filename, $to, 0, strlen($this->filename));
				rename($fileinfo->getRealPath(), $fileinfo->getPath() . DIRECTORY_SEPARATOR . $renamed);
			}
		}
	}
322906
public function renameFile($file, $to = null) {
		if(!is_array($file)) // rename(file, to);
		{
			$file = [
				$file => $to,
			];
		}
		$this->begin();
		foreach($file as $from => $to) {
			$this->run('git mv', $from, $to);
		}
		return $this->end();
	}
1234210
public boolean rename(final File from, final File to) {
    boolean renamed = false;
    if (this.isWriteable(from)) {
      renamed = from.renameTo(to);
    } else {
      LogLog.debug(from + " is not writeable for rename (retrying)");
    }
    if (!renamed) {
      from.renameTo(to);
      renamed = (!from.exists());
    }
    return renamed;
  }
1087099
public function renameFolder($from, $to)
    {
        $result = $this->execute('RENAME', array($this->escape($from), $this->escape($to)),
            self::COMMAND_NORESPONSE);

        return $result == self::ERROR_OK;
    }
681335
protected function publishItem($from, $to)
    {
        if ($this->files->isFile($from)) {
            return $this->publishFile($from, $to);
        } elseif ($this->files->isDirectory($from)) {
            return $this->publishDirectory($from, $to);
        }

        $this->error("Can't locate path: <{$from}>");
    }