---
title: "renameFile"
canonical: "https://support.appfire.com/space/PSJC/433654462/renameFile"
format: markdown
---
> Macro (aura-html)


## Description

> Macro (excerpt)
> 
> Renames a file.

Renames a file. Returns "true" if the file was renamed successfully and "false" otherwise. If "false" is returned check the log for a detailed reason on why it failed.

|  |  |  |  |
| --- | --- | --- | --- |
| **Syntax** | renameFile(path_to_source, path_to_destination) | **Package** | file |
| **Alias** |  | **Pkg Usage** | rename(path_to_source, path_to_destination) |

## Parameters

| Parameter name | Type | Required | Description |
| --- | --- | --- | --- |
| path_to_source | String | Yes | Specifies the source file name. |
| path_to_destination | String | Yes | Specifies the new file name for the source file. |

## Return Type

**Boolean (true/false)**

## Example

```javascript
renameFile("C:/source.txt", "C:/destination.txt");
```

It returns 'true' if the **source.txt **file was renamed to **destination.txt**.

> ⚠️ It is recommended that you use forward slashes ( / ) for file paths.

## See also

> Macro (contentbylabel)