# gfs_rename

## 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).

`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.