---
name: "gfs_rename"
section: "3"
platform: "linux"
package: "libgfarm-dev"
version: "2.4.1-1.1"
release: "Debian 7 (Wheezy)"
platforms: ["linux"]
url: "https://new.carta.tech/gfs_rename"
---

# gfs\_rename(3)

change the name or location of a file

## NAME

gfs\_rename - change the name or location of a file

## SYNOPSIS

**#include \<gfarm/gfarm.h\>**

**char \*gfs\_rename (char \*** *gfarm\_url\_from***, char \*** *gfarm\_url\_to***);**

## DESCRIPTION

**gfs\_rename** renames a file or directory *gfarm\_url\_from* to  *gfarm\_url\_to*.

If *gfarm\_url\_to* already exists, it will be replaced.  In this case, when *gfarm\_url\_from* is a file *gfarm\_url\_to* also must be a file, when *gfarm\_url\_from* is a directory, *gfarm\_url\_to* must be a empty directory.

**Gfs\_rename()** can't rename a directory to a subdirectory of itself.

## RETURN VALUES

- **NULL**

  The function terminated successfully.

- **GFARM\_ERR\_NO\_MEMORY**

  Insufficient memory was available.

- **GFARM\_ERR\_AUTHENTICATION**

  User authentication failed when connecting to [gfmd(8)](/gfmd/8.md).

- **GFARM\_ERR\_PERMISSION\_DENIED**

  The parent directory of *gfarm\_url\_from* or *gfarm\_url\_to* did not allow write permission.

- **GFARM\_ERR\_INVALID\_ARGUMENT**

  A attempt was made to rename the directory *gfarm\_url\_from* to a subdirectory of itself.

- **GFARM\_ERR\_NO\_SUCH\_OBJECT**

  *gfarm\_url\_from* does not exist.

- **GFARM\_ERR\_IS\_A\_DIRECTORY**

  *gfarm\_url\_to* is a existing directory, though *gfarm\_url\_from* is not a directory.

- **GFARM\_NOT\_IS\_A\_DIRECTORY**

  *gfarm\_url\_to* is not a directory. though *gfarm\_url\_from* is a directory.

- **Others**

  An error except the above occurred.  The reason is shown by its pointed strings.
