---
name: "SDL_RenamePath"
section: "3"
platform: "linux"
package: "libsdl3-doc"
version: "3.2.10+ds-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/SDL_RenamePath"
---

# SDL\_RenamePath(3)

Rename a file or directory.

## NAME

SDL\_RenamePath - Rename a file or directory.

## HEADER FILE

Defined in SDL3/SDL\_filesystem.h

## SYNOPSIS

```
#include "SDL3/SDL.h"
```

**bool SDL\_RenamePath(const char \*oldpath, const char \*newpath);**

## DESCRIPTION

If the file at **newpath** already exists, it will replaced.

Note that this will not copy files across filesystems/drives/volumes, as that is a much more complicated (and possibly time-consuming) operation.

Which is to say, if this function fails,  **SDL\_CopyFile** () to a temporary file in the same directory as **newpath** , then

**SDL\_RenamePath** () from the temporary file to **newpath** and

**SDL\_RemovePath** () on **oldpath** might work for files. Renaming a non-empty directory across filesystems is dramatically more complex, however.

## FUNCTION PARAMETERS

- *oldpath*

  the old path.

- *newpath*

  the new path.

## RETURN VALUE

Returns true on success or false on failure; call

**SDL\_GetError** () for more information.

## AVAILABILITY

This function is available since SDL 3.2.0.
