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.

Syntax
Luau
movefile(source: string, destination: string) -> ()

Parameters

Function parameters
ParameterTypeDescription
sourcestringWorkspace-relative path of the existing file.
destinationstringWorkspace-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

Example
Luau
writefile("export.json", "{}")
movefile("export.json", "exports/2026/export.json")
print(isfile("exports/2026/export.json")) -- true
delfolder("exports")