// Rename file on the remote host
173301
func (ftp *FTP) Rename(from string, to string) (err error) {
	if _, err = ftp.cmd(StatusActionPending, "RNFR %s", from); err != nil {
		return
	}

	if _, err = ftp.cmd(StatusActionOK, "RNTO %s", to); err != nil {
		return
	}

	return
}
603022
func (fs MountFS) Rename(oldpath, newpath string) error {
	oldMount, oldInnerPath := findMount(oldpath, fs.mounts, fs.rootFS, string(fs.PathSeparator()))
	newMount, newInnerPath := findMount(newpath, fs.mounts, fs.rootFS, string(fs.PathSeparator()))
	if oldMount != newMount {
		return ErrBoundary
	}
	return oldMount.Rename(oldInnerPath, newInnerPath)
}
763997
func renameAborted() error {
	if err := pkgPod.WalkPods(getDataDir(), pkgPod.IncludePrepareDir, func(p *pkgPod.Pod) {
		if p.State() == pkgPod.AbortedPrepare {
			stderr.Printf("moving failed prepare %q to garbage", p.UUID)
			if err := p.ToGarbage(); err != nil && err != os.ErrNotExist {
				stderr.PrintE("rename error", err)
			}
		}
	}); err != nil {
		return err
	}
	return nil
}
846676
func (s *storageRESTServer) RenameFileHandler(w http.ResponseWriter, r *http.Request) {
	if !s.IsValid(w, r) {
		return
	}
	vars := mux.Vars(r)
	srcVolume := vars[storageRESTSrcVolume]
	srcFilePath := vars[storageRESTSrcPath]
	dstVolume := vars[storageRESTDstVolume]
	dstFilePath := vars[storageRESTDstPath]
	err := s.storage.RenameFile(srcVolume, srcFilePath, dstVolume, dstFilePath)
	if err != nil {
		s.writeErrorResponse(w, err)
	}
}
66540
func (c *Client) Rename(from, to string) error {
	pconn, err := c.getIdleConn()
	if err != nil {
		return err
	}

	defer c.returnConn(pconn)

	err = pconn.sendCommandExpected(replyFileActionPending, "RNFR %s", from)
	if err != nil {
		return err
	}

	return pconn.sendCommandExpected(replyFileActionOkay, "RNTO %s", to)
}
726346
func Replace(from, to string) error {
	if err := os.RemoveAll(to); err != nil {
		return err
	}
	if err := os.Rename(from, to); err != nil {
		return err
	}

	// Directory was renamed; sync parent dir to persist rename.
	pdir, err := OpenDir(filepath.Dir(to))
	if err != nil {
		return err
	}

	if err = pdir.Sync(); err != nil {
		pdir.Close()
		return err
	}
	return pdir.Close()
}
190713
func (db *DB) Rename(oldName, newName string) error {
	db.schemaLock.Lock()
	defer db.schemaLock.Unlock()
	if _, exists := db.cols[oldName]; !exists {
		return fmt.Errorf("Collection %s does not exist", oldName)
	} else if _, exists := db.cols[newName]; exists {
		return fmt.Errorf("Collection %s already exists", newName)
	} else if err := db.cols[oldName].close(); err != nil {
		return err
	} else if err := os.Rename(path.Join(db.path, oldName), path.Join(db.path, newName)); err != nil {
		return err
	} else if db.cols[newName], err = OpenCol(db, newName); err != nil {
		return err
	}
	delete(db.cols, oldName)
	return nil
}
760944
func (c *asyncClient) Rename(arg0 string, arg1 string) (stat FutureBool, err Error) {
	arg0bytes := []byte(arg0)
	arg1bytes := []byte(arg1)

	resp, err := c.conn.QueueRequest(&RENAME, [][]byte{arg0bytes, arg1bytes})
	if err == nil {
		stat = resp.future.(FutureBool)
	}

	return
}
453157
func ExcelSheetNameReplace(fileName string) string {
	r := []rune(fileName)
	size := len(r)
	for i := 0; i < size; i++ {
		switch r[i] {
		case ':', '：', '*', '?', '？', '/', '／', '\\', '╲', ']', '[':
			r[i] = '_'
		}
	}
	return strings.Replace(string(r), USE_KEYIN, ``, -1)
}
1155714
func (fs *Datastore) renameAndUpdateDiskUsage(tmpPath, path string) error {
	fi, err := os.Stat(path)

	// Destination exists, we need to discount it from diskUsage
	if fs != nil && err == nil {
		atomic.AddInt64(&fs.diskUsage, -fi.Size())
	} else if !os.IsNotExist(err) {
		return err
	}

	// Rename and add new file's diskUsage. If the rename fails,
	// it will either a) Re-add the size of an existing file, which
	// was sustracted before b) Add 0 if there is no existing file.
	err = os.Rename(tmpPath, path)
	fs.updateDiskUsage(path, true)
	return err
}
1132971
func Rename(u *user.User, oldpath, newpath string) error {
	uid, gid, err := getIds(u)
	if err != nil {
		return err
	}
	args := C.au_rename_args_t{
		ids:     C.au_ids_t{uid: uid, gid: gid},
		oldpath: C.CString(oldpath),
		newpath: C.CString(newpath),
	}

	if ret, err := C.au_rename(&args); ret < 0 {
		return err
	}
	return nil
}
123661
func (fs *fakeFs) Rename(oldpath, newpath string) error {
	return fs.a.Fs.Rename(oldpath, newpath)
}
1024671
func (api *API) RenameServer(server_id string, new_name string, new_desc string) (*Server, error) {
	data := struct {
		Name        string `json:"name,omitempty"`
		Description string `json:"description,omitempty"`
	}{Name: new_name, Description: new_desc}
	result := new(Server)
	url := createUrl(api, serverPathSegment, server_id)
	err := api.Client.Put(url, &data, &result, http.StatusOK)
	if err != nil {
		return nil, err
	}
	result.api = api
	result.decodeRaws()
	return result, nil
}
99947
func normalize(name string) (string, error) {
	host, remoteName := splitHostname(name)
	if strings.ToLower(remoteName) != remoteName {
		return "", errors.New("invalid reference format: repository name must be lowercase")
	}
	if host == DefaultHostname {
		if strings.HasPrefix(remoteName, DefaultRepoPrefix) {
			return strings.TrimPrefix(remoteName, DefaultRepoPrefix), nil
		}
		return remoteName, nil
	}
	return name, nil
}
84648
func (u *CopyOnWriteFs) Rename(oldname, newname string) error {
	b, err := u.isBaseFile(oldname)
	if err != nil {
		return err
	}
	if b {
		return syscall.EPERM
	}
	return u.layer.Rename(oldname, newname)
}
514084
func (c *Client) Rename(oldpath, newpath string, overwrite bool) error {
	return c.copymove("MOVE", oldpath, newpath, overwrite)
}
1320965
func (s *Shape) Rename(newName string) {
	if s.AliasedShapeName {
		panic(fmt.Sprintf("attempted to rename %s, but flagged as aliased",
			s.ShapeName))
	}

	for _, r := range s.refs {
		r.OrigShapeName = r.ShapeName
		r.ShapeName = newName
	}

	delete(s.API.Shapes, s.ShapeName)
	s.OrigShapeName = s.ShapeName
	s.API.Shapes[newName] = s
	s.ShapeName = newName
}