Renames a file.

@param string $sourceKey
@param string $targetKey

@return bool
966430
public function rename($sourceKey, $targetKey)
    {
        if (false !== $this->write($targetKey, $this->read($sourceKey))) {
            $this->delete($sourceKey);

            return true;
        }

        return false;
    }
135996
public function moveLocal($targetDir = null, $targetFilename = null)
    {
        // source file
        $sourceFile = $this->getTransport()->getFile();

        // target base name
        $targetBasename = $this->buildTargetBasename($sourceFile, $targetFilename);

        // target path
        if (!$targetDir) {
            $targetDir = $this->getDefaultLocalUploadDirectory();
        }
        $targetPath = $targetDir . '/' . $targetBasename;

        // if target dir not exists - create it
        if (!file_exists($targetDir)) {
            $oldUmast = umask(0);
            mkdir($targetDir, 0777, true);
            umask($oldUmast);
        }

        // move file to target dir
        return $this
            ->getTransport()
            ->moveLocal($targetPath);
    }
463336
protected function _copy($source, $targetDir, $name) {
		$this->clearcache();
		$id = $this->_joinPath($targetDir, $name);

		$sql = $id > 0
			? sprintf('REPLACE INTO %s (id, parent_id, name, content, size, mtime, mime, width, height, `read`, `write`, `locked`, `hidden`) (SELECT %d, %d, name, content, size, mtime, mime, width, height, `read`, `write`, `locked`, `hidden` FROM %s WHERE id=%d)', $this->tbf, $id, $this->_dirname($id), $this->tbf, $source)
			: sprintf('INSERT INTO %s (parent_id, name, content, size, mtime, mime, width, height, `read`, `write`, `locked`, `hidden`) SELECT %d, "%s", content, size, %d, mime, width, height, `read`, `write`, `locked`, `hidden` FROM %s WHERE id=%d', $this->tbf, $targetDir, $this->db->real_escape_string($name), time(), $this->tbf, $source);

		return $this->query($sql);
	}
179688
public function rename($newKey)
    {
        $this->filesystem->rename($this->key, $newKey);

        $this->key = $newKey;
    }
1337940
protected function _copy($source, $targetDir, $name) {
		$res = false;
		
		if ($this->tmp) {
			$local  = $this->getTempFile();
			$target = $targetDir.DIRECTORY_SEPARATOR.$name;

			if (ftp_get($this->connect, $local, $source, FTP_BINARY)
			&& ftp_put($this->connect, $target, $local, $this->ftpMode($target))) {
				$res = $target;
			}
			@unlink($local);
		}
		
		return $res;
	}
67999
protected function copyConfigurationFile($source, $target)
    {
        $fs = new Filesystem();
        $fs->copy($source, $target, true);

        if (!$this->output->isQuiet()) {
            $this->output->writeln("Copied $source to $target");
        }
    }
114595
public function copyFile($sourceFile, $file)
    {
        if (!$this->createDirectory(dirname($file))) {
            return false;
        }

        if ($this->isFileAlreadyExist($file)) {
            return true;
        }

        return Silencer::call(
            'copy',
            $this->filesystem->normalizePath($sourceFile),
            $this->filesystem->normalizePath($file)
        );
    }
24879
public static void renameTo(File sourceFile, File destFile) {
        if (sourceFile.exists() && !destFile.exists()) {
            createFolder(destFile.getParent());
            sourceFile.renameTo(destFile);
        }
    }
700890
public function rename(FileName $aName)
    {
        if ($aName->extension() !== $this->name()->extension()) {
            throw new FileNameInvalidException();
        }

        $this->name = $aName;
        $this->updatedOn = new \DateTimeImmutable();

        $this->publish(new FileRenamed($this->id()));
    }
73159
public function rename($currentKey, $newKey)
    {
        if ($this->has($currentKey)) {
            $this->set($newKey, $this->proxy->{$currentKey})->remove($currentKey);
        }

        return $this;
    }
785184
public static function renameFolder( $sourceFolder, $targetName )
	{
		$targetName	= basename( $targetName );
		if( !self::isFolder( $sourceFolder ) )												//  Source Folder not existing
			throw new RuntimeException( 'Folder "'.$sourceFolder.'" is not existing' );

		$sourcePath	= self::correctPath( dirname( $sourceFolder ) );						//  Path to Source Folder
		if( basename( $sourceFolder ) == $targetName )										//  Source Name and Target name is equal
			return FALSE;
		if( self::isFolder( $sourcePath.$targetName ) )										//  Target Folder is already existing
			throw new RuntimeException( 'Folder "'.$sourcePath.$targetName.'" is already existing' );
		if( FALSE === @rename( $sourceFolder, $sourcePath.$targetName ) )					//  rename Source Folder to Target Folder
			throw new RuntimeException( 'Folder "'.$sourceFolder.'" cannot be renamed to "'.$sourcePath.$targetName.'"' );
		return TRUE;
	}
617599
public static function convertIniToJson( $sourceFile, $targetFile )
	{
		$data	= self::loadIni( $sourceFile );
		return self::saveJson( $targetFile, $data );
	}
1115646
public static function renameKey(array &$arr, $oldKey, $newKey): void
    {
        $offset = self::searchKey($arr, $oldKey);
        if ($offset !== null) {
            $keys = \array_keys($arr);
            $keys[$offset] = $newKey;
            $arr = \array_combine($keys, $arr);
        }
    }
416455
public function minifyJs($sourceFileList, $targetFile) {
        $sourceFileList = (array)$sourceFileList;
        $sourceFileList = array_map(array($this, '_createFullPath'), $sourceFileList);
        $sourceFileList = implode(' ', $sourceFileList);
        $targetFile = $this->_createFullPath($targetFile);

        $uglifyJsCommand = 'uglifyjs '.$sourceFileList.' -o '.$targetFile.' -c -m';
        `$uglifyJsCommand`;
    }
7118
public function rename($bucketName, $bucketId, $fileName, $targetBucketId, $newFileName, $private = false)
    {
        $data = $this->get($bucketName, $fileName, $private, false);
        if (is_array($data) && array_key_exists('x-bz-file-id', $data['headers'])) {
            $result = $this->insert($targetBucketId, $data['content'], $newFileName);
            if ($result === false) {
                return false;
            }
            $response = $this->client->b2DeleteFileVersion($this->apiURL, $this->token, $data['headers']['x-bz-file-id'], $fileName);

            return $response->isOk();
        }

        return false;
    }
761120
protected function addIfIsset(array &$target, $key, array $source)
    {
        if (isset($source[$key])) {
            $target[$key] = $source[$key];
            return true;
        }
        return false;
    }
877574
public function move($sourcePath, $destinationPath)
    {
        list($sourceDir) = Uri\split($sourcePath);
        list($destinationDir, $destinationName) = Uri\split($destinationPath);

        if ($sourceDir === $destinationDir) {
            // If this is a 'local' rename, it means we can just trigger a rename.
            $sourceNode = $this->getNodeForPath($sourcePath);
            $sourceNode->setName($destinationName);
        } else {
            $newParentNode = $this->getNodeForPath($destinationDir);
            $moveSuccess = false;
            if ($newParentNode instanceof IMoveTarget) {
                // The target collection may be able to handle the move
                $sourceNode = $this->getNodeForPath($sourcePath);
                $moveSuccess = $newParentNode->moveInto($destinationName, $sourcePath, $sourceNode);
            }
            if (!$moveSuccess) {
                $this->copy($sourcePath, $destinationPath);
                $this->getNodeForPath($sourcePath)->delete();
            }
        }
        $this->markDirty($sourceDir);
        $this->markDirty($destinationDir);
    }