Files
2025-10-25 03:02:53 +03:00

1.5 KiB

[fs.op.rename]

31 Input/output library [input.output]

31.12 File systems [filesystems]

31.12.13 Filesystem operation functions [fs.op.funcs]

31.12.13.33 Rename [fs.op.rename]

🔗

void filesystem::rename(const path& old_p, const path& new_p); void filesystem::rename(const path& old_p, const path& new_p, error_code& ec) noexcept;

1

#

Effects: Renames old_p to new_p, as if by POSIX rename.

[Note 1:

  • (1.1)

    If old_p and new_p resolve to the same existing file, no action is taken.

  • (1.2)

    Otherwise, the rename can include the following effects:

if new_p resolves to an existing non-directory file, new_p is removed; otherwise,

if new_p resolves to an existing directory, new_p is removed if empty on POSIX compliant operating systems but might be an error on other operating systems.

A symbolic link is itself renamed, rather than the file it resolves to.

— end note]

2

#

Throws: As specified in [fs.err.report].