Skip to content

mv ​

Moves (renames) a file or directory from src to dest on the same filesystem. Cross-device moves return ERR_FS_MV_FAILED; the source is left in place.

Signaturemv(src: string, dest: string): Result<void, FsError>

The operation returns Err(FsError) on failure; inspect it with match or propagate it with ?.

Example ​

tyrus
import { mv, type FsError } from "tyrus:fs";

match (mv("old.txt", "new.txt")) {
    Ok(_) => {}
    Err(error) => { printError(error.code); // ERR_FS_MV_FAILED
    }
}