movefile Synchronous
Move a workspace file to another path, creating any missing folders on the way. Use it to file finished output into a folder of its own.
Luau
movefile(source: string, destination: string) -> ()Parameters
| Parameter | Type | Description |
|---|---|---|
source | string | Workspace-relative path of the existing file. |
destination | string | Workspace-relative path to move it to. |
Returns
()No values.
Usage notes
Only files can be moved, not folders. The call raises if the source is not a file or the destination already exists, so an existing file is never overwritten. renamefile is the same operation.
Example
Luau
writefile("export.json", "{}")
movefile("export.json", "exports/2026/export.json")
print(isfile("exports/2026/export.json")) -- true
delfolder("exports")