Renames a file. May fail if "to" already exists or is on another drive.
548440
function(from, to) {
					from = frontSlash(from);
					to = frontSlash(to);
					if (this.exists(from)) {
						cache[to] = cache[from];
						cache[to].path = to;
						cache[from] = null;
						delete cache[from];
						return true;
					}
				}
175126
def move_file_to_file(old_path, new_path):
        
        try:
            os.rename(old_path, new_path)
        except:
            old_file = os.path.basename(old_path)
            target_directory, target_file = os.path.dirname(
                os.path.abspath(new_path)), os.path.basename(new_path)
            Document.move_file_to_directory(
                old_path,
                target_directory
            )  # move old file to new directory, change name to new name
            os.rename(os.path.join(target_directory, old_file),
                      os.path.join(target_directory, target_file))
1281244
def move(self, old_path, new_path, raise_if_exists=False):
        
        if raise_if_exists and os.path.exists(new_path):
            raise FileAlreadyExists('Destination exists: %s' % new_path)
        d = os.path.dirname(new_path)
        if d and not os.path.exists(d):
            self.mkdir(d)
        try:
            os.rename(old_path, new_path)
        except OSError as err:
            if err.errno == errno.EXDEV:
                new_path_tmp = '%s-%09d' % (new_path, random.randint(0, 999999999))
                shutil.copy(old_path, new_path_tmp)
                os.rename(new_path_tmp, new_path)
                os.remove(old_path)
            else:
                raise err
510316
function renameFiles(files)
{
  files.forEach(function (file)
  {
    var originalName = path.basename(file);
    var newFileName = originalName.toLowerCase();
    var directory = path.dirname(file);
    if (originalName != newFileName)
    {
      fs.renameSync(file, directory + "/" + newFileName); //, function(err)

      if (debug)
        console.log('Renamed: %s --> %s', originalName, newFileName);

      originalFiles.push(originalName);
      renamedFiles.push(newFileName);
    }
  });
}
359766
@Nonnull
  public static FileIOError renameFile (@Nonnull final File aSourceFile, @Nonnull final File aTargetFile)
  {
    ValueEnforcer.notNull (aSourceFile, "SourceFile");
    ValueEnforcer.notNull (aTargetFile, "TargetFile");

    // Does the source file exist?
    if (!FileHelper.existsFile (aSourceFile))
      return EFileIOErrorCode.SOURCE_DOES_NOT_EXIST.getAsIOError (EFileIOOperation.RENAME_FILE, aSourceFile);

    // Are source and target different?
    if (EqualsHelper.equals (aSourceFile, aTargetFile))
      return EFileIOErrorCode.SOURCE_EQUALS_TARGET.getAsIOError (EFileIOOperation.RENAME_FILE, aSourceFile);

    // Does the target file already exist?
    if (aTargetFile.exists ())
      return EFileIOErrorCode.TARGET_ALREADY_EXISTS.getAsIOError (EFileIOOperation.RENAME_FILE, aTargetFile);

    // Is the source parent directory writable?
    final File aSourceParentDir = aSourceFile.getParentFile ();
    if (aSourceParentDir != null && !aSourceParentDir.canWrite ())
      return EFileIOErrorCode.SOURCE_PARENT_NOT_WRITABLE.getAsIOError (EFileIOOperation.RENAME_FILE, aSourceFile);

    // Is the target parent directory writable?
    final File aTargetParentDir = aTargetFile.getParentFile ();
    if (aTargetParentDir != null && aTargetParentDir.exists () && !aTargetParentDir.canWrite ())
      return EFileIOErrorCode.TARGET_PARENT_NOT_WRITABLE.getAsIOError (EFileIOOperation.RENAME_FILE, aTargetFile);

    // Ensure parent of target directory is present
    FileHelper.ensureParentDirectoryIsPresent (aTargetFile);

    try
    {
      final EFileIOErrorCode eError = aSourceFile.renameTo (aTargetFile) ? EFileIOErrorCode.NO_ERROR
                                                                         : EFileIOErrorCode.OPERATION_FAILED;
      return eError.getAsIOError (EFileIOOperation.RENAME_FILE, aSourceFile, aTargetFile);
    }
    catch (final SecurityException ex)
    {
      return EFileIOErrorCode.getSecurityAsIOError (EFileIOOperation.RENAME_FILE, ex);
    }
  }
848501
def move(self, path, raise_if_exists=False):
        
        self.rename(path, raise_if_exists=raise_if_exists)
196364
def rename_to_temp(filename):
    """"""
    with _rename_to_temp_lock:
        root, ext = os.path.splitext(filename)
        if len(ext) > 0:
            ext = ext[1:]  # the dot (".") is originally included
        new_name = new_filename(root, ext)
        os.rename(filename, new_name)
        return new_name
777394
def rename(path):
    """"""

    new_path = prompt(path)

    if path != new_path:
        try:
            from shutil import move
        except ImportError:
            from os import rename as move

        move(path, new_path)

    return new_path
785905
def copy(self, filename=None):
        
        dst = os.path.join(self.dst_path, filename)
        src = os.path.join(self.src_path, filename)
        dst_tmp = os.path.join(self.dst_tmp, filename)
        self.put(src=src, dst=dst_tmp, callback=self.update_progress, confirm=True)
        self.rename(src=dst_tmp, dst=dst)
73962
def file_rename(object_id, input_params={}, always_retry=True, **kwargs):
    
    return DXHTTPRequest('/%s/rename' % object_id, input_params, always_retry=always_retry, **kwargs)
910306
private void renameFile(File source, File target) {
        if (!source.exists()) {
            // don't do anything if the source file doesn't exist
            return;
        }
        if (target.exists()) {
            target.delete();
        }
        boolean rc = source.renameTo(target);
        if (!rc) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, getFileName() + ": Unable to rename " + source + " to " + target);
            }
        }
    }
954990
static function rename($from, $to)
    {
        $result = false;
        if (file_exists($from)){
            $to = self::makeVirtualDir($to);
            $dir = dirname($to);
            if (!is_dir($dir)) mkdir($dir, true);
            if (mb_strtoupper($from) != mb_strtoupper($to)){
                if (is_dir($to)){
                    self::clear_dir($to, true);
                }else
                if (is_file($to)){
                    unlink($to);
                }
            }
            $result = rename($from, $to);
            self::deleteVirtualDir($to);
        }
        return $result;
    }
299360
public Response rename(String bucket, String oldFileKey, String newFileKey, boolean force)
            throws QiniuException {
        return move(bucket, oldFileKey, bucket, newFileKey, force);
    }
922108
def execute(filename, formatted_name):
    

    if os.path.isfile(formatted_name):
        # If the destination exists, skip rename unless overwrite enabled
        if not cfg.CONF.overwrite_file_enabled:
            LOG.info('File %s already exists not forcefully moving %s',
                     formatted_name, filename)
            return

    LOG.info('renaming [%s] to [%s]', filename, formatted_name)
    if not cfg.CONF.dryrun:
        shutil.move(filename, formatted_name)
152068
def rename(self, from_, to):
        
        blueprint = self._create_blueprint(from_)

        blueprint.rename(to)

        self._build(blueprint)
320122
public boolean renameTo( Resource dest)
        throws SecurityException
    {
        if( dest instanceof FileResource)
            return _file.renameTo( ((FileResource)dest)._file);
        else
            return false;
    }
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;
  }