Path.rename
void rename(string target) constRenames or moves the file or directory represented by this Path to target.
Semantics follow Python's pathlib Path.rename() as closely as possible:
- On POSIX, this uses
rename(2)which is atomic and will overwrite the destination if it exists when the source and destination are on the same filesystem (see alsoreplace). - On Windows, this maps to
std.file.rename, which fails if the target exists. Usereplaceto ensure overwrite semantics.Parameters
targetThe destination file or directory path.