Skip to content

fs.move

Moves or renames a file or directory from one path to another.

Signature

luau
function move(from: string, to: string): ()

Summary

Parameters

ParameterTypeDescription
fromstringThe target path
tostringThe destination path.

Example

luau
local fs = require("@std/fs")

-- Rename
fs.move("old_name.txt", "new_name.txt")

-- Move
fs.move("output.txt", "archive/output.txt")