A wrapper around {@link FileContext#rename(Path, Path, Options.Rename...)}.
967122
public static void renamePath(FileContext fc, Path oldName, Path newName) throws IOException {
    renamePath(fc, oldName, newName, false);
  }
271525
def rename(self, path, destination, **kwargs):
        
        return _json(self._put(path, 'RENAME', destination=destination, **kwargs))['boolean']
632950
public void rename(String newName) {
        URL url = FOLDER_INFO_URL_TEMPLATE.build(this.getAPI().getBaseURL(), this.getID());
        BoxJSONRequest request = new BoxJSONRequest(this.getAPI(), url, "PUT");

        JsonObject updateInfo = new JsonObject();
        updateInfo.add("name", newName);

        request.setBody(updateInfo.toString());
        BoxJSONResponse response = (BoxJSONResponse) request.send();
        response.getJSON();
    }
990395
function rename(oldPath, newPath, callback) {
        appshell.fs.rename(oldPath, newPath, _wrap(callback));
    }
1148784
private boolean rename(String src, String dst) throws IOException {
    src = stripPath(src);
    dst = stripPath(dst);
    File file = new File(src);
    return file.renameTo(new File(dst));
  }
392746
def file_renamed(self, editor, new_filename):
        """"""
        if editor is None:
            # This is needed when we can't find an editor to attach
            # the outline explorer to.
            # Fix issue 8813
            return
        editor_id = editor.get_id()
        if editor_id in list(self.editor_ids.values()):
            root_item = self.editor_items[editor_id]
            root_item.set_path(new_filename, fullpath=self.show_fullpath)
            self.__sort_toplevel_items()
424896
private function renameDirectory($path, $rename)
    {
        if ($this->isSFTP()) {
            $renamed = @$this->ftp->rename($path, $rename);
        } else {
            $renamed = @ftp_rename($this->ftp, $path, $rename);
        }
        if (!$renamed) {
            $this->fail("couldn't rename directory {$path} to {$rename}");
        }
        $this->debug("Renamed directory: {$path} to {$rename}");
    }
206135
def rename_with_prefix(self, prefix="", new_path=None, in_place=True, remove_desc=True):
        """"""
        # Temporary path #
        if new_path is None: prefixed = self.__class__(new_temp_path())
        else:                prefixed = self.__class__(new_path)
        # Generator #
        def prefixed_iterator():
            for i,read in enumerate(self):
                read.id = prefix + read.id
                if remove_desc: read.description = ""
                yield read
        # Do it #
        prefixed.write(prefixed_iterator())
        prefixed.close()
        # Replace it #
        if in_place:
            os.remove(self.path)
            shutil.move(prefixed, self.path)
        return prefixed
24879
public static void renameTo(File sourceFile, File destFile) {
        if (sourceFile.exists() && !destFile.exists()) {
            createFolder(destFile.getParent());
            sourceFile.renameTo(destFile);
        }
    }
1027978
public static void renamePath(FileSystem fs, Path oldName, Path newName) throws IOException {
    renamePath(fs, oldName, newName, false);
  }
952044
def rename(path, new_name, options={})
      raise ArgumentError, "Names cannot have slashes in them" if new_name.include?('/')
      path = path.sub(/\/$/, '')
      destination = path.split('/')
      destination[destination.size - 1] = new_name
      destination = destination.join('/')
      move path, destination, options
    end
796575
private boolean rename(String src, String dst) throws IOException {
    IOException te = null;
    FileSystem hdfs = getFs();
    RetryPolicy retryPolicy = new CountingRetry(MAX_TRY);
    while (retryPolicy.attempt()) {
      try {
        return hdfs.rename(new Path(src), new Path(dst));
      } catch (IOException e) {
        LOG.warn("{} try to rename {} to {} : {}", retryPolicy.getAttemptCount(), src, dst,
            e.getMessage());
        te = e;
      }
    }
    throw te;
  }
1009313
public void renameAttachmentTo(String newAttachmentName) throws Exception {
		JSONObject doc = documentDescriptor.getJson();
		JSONObject _attachments = doc.optJSONObject("_attachments");
		JSONObject nunaliit_attachments = doc.getJSONObject(UploadConstants.KEY_DOC_ATTACHMENTS);
		JSONObject files = nunaliit_attachments.getJSONObject("files");

		// Verify no collision within nunaliit_attachments.files
		{
			Object obj = files.opt(newAttachmentName);
			if( null != obj ){
				throw new Exception("Can not rename attachment because of name collision");
			}
		}
		
		// Verify no collision within _attachments
		if( null != _attachments ){
			Object obj = _attachments.opt(newAttachmentName);
			if( null != obj ){
				throw new Exception("Can not rename attachment because of name collision");
			}
		}

		// Not allowed to move a stub		
		if( null != _attachments ){
			JSONObject att = _attachments.optJSONObject(attName);
			if( null != att ){
				throw new Exception("Can not rename attachment descriptor because file is already attached");
			}
		}
		
		// Move descriptor to new name
		String oldAttachmentName = attName;
		JSONObject descriptor = files.getJSONObject(oldAttachmentName);
		files.remove(oldAttachmentName);
		files.put(newAttachmentName, descriptor);
		attName = newAttachmentName;
		setStringAttribute(UploadConstants.ATTACHMENT_NAME_KEY,newAttachmentName);
		
		// Loop through all attachment descriptors, updating "source", "thumbnail"
		// and "original" attributes
		{
			Iterator<?> it = files.keys();
			while( it.hasNext() ){
				Object objKey = it.next();
				if( objKey instanceof String ){
					String key = (String)objKey;
					JSONObject att = files.getJSONObject(key);
					
					{
						String value = att.optString("source", null);
						if( oldAttachmentName.equals(value) ){
							att.put("source", newAttachmentName);
						}
					}

					{
						String value = att.optString("thumbnail", null);
						if( oldAttachmentName.equals(value) ){
							att.put("thumbnail", newAttachmentName);
						}
					}

					{
						String value = att.optString("originalAttachment", null);
						if( oldAttachmentName.equals(value) ){
							att.put("original", newAttachmentName);
						}
					}
				}
			}
		}
	}
312749
public static ISynchronizationPoint<IOException> rename(File source, File destination, byte priority) {
		// TODO we should use the roots instead of drive
		TaskManager t1 = Threading.getDrivesTaskManager().getTaskManager(source);
		TaskManager t2 = Threading.getDrivesTaskManager().getTaskManager(destination);
		if (t1 == t2)
			return new RenameFileTask(t1, source, destination, priority).start().getOutput();
		AsyncWork<Long, IOException> copy = IOUtil.copy(source, destination, priority, source.length(), null, 0, null);
		SynchronizationPoint<IOException> result = new SynchronizationPoint<>();
		copy.listenInline(() -> {
			new RemoveFileTask(source, priority).start().getOutput().listenInline(result);
		}, result);
		return result;
	}
892
public static void renamePath(FileSystem fs, Path oldName, Path newName, boolean overwrite) throws IOException {
    if (!fs.exists(oldName)) {
      throw new FileNotFoundException(String.format("Failed to rename %s to %s: src not found", oldName, newName));
    }
    if (fs.exists(newName)) {
      if (overwrite) {
        HadoopUtils.moveToTrash(fs, newName);
      } else {
        throw new FileAlreadyExistsException(
            String.format("Failed to rename %s to %s: dst already exists", oldName, newName));
      }
    }
    if (!fs.rename(oldName, newName)) {
      throw new IOException(String.format("Failed to rename %s to %s", oldName, newName));
    }
  }
98519
function rename(opts) {
    opts = opts || {};

    return through.obj(function (file, enc, cb) {
        file.path = opts.path;
        cb(null, file);
    });
}
282813
public boolean rename (Path src, Path dst) throws IOException {
    try (Closeable context =  new TimerContextWithLog(renameTimer.time(), "rename", src, dst)) {
      return super.rename(src, dst);
    }
  }