Move the file or directory at the specified oldPath to the specified newPath. On Windows, this operation occurs in two steps: first, if there is a regular file or file symbolic link at newPath, it is removed; if there is a directory or directory symbolic link at newPath, this function fails with no effect. Second, the file or directory at oldPath is actually moved; this operation fails with no further effect if the source and destination are on different volumes or if the source does not exist (including in the case where oldPath and newPath are the same path). On Unix, the operation is always atomic, with the file or directory at newPath being replaced by the item at oldPath; the operation fails if the source and destination are on different filesystems, if the source and destination are different kinds of item (that is, one is a file and the other is a directory), or if the destination is a non-empty directory, except that it succeeds if the source and destination are the same directory; a symbolic link is considered an existing file even if it is broken or it points to a directory. On all platforms, if oldPath is a symbolic link, the link will be moved, not its target. Return 0 on success, and a non-zero value otherwise. The parameterized OLD_STRING_TYPE and NEW_STRING_TYPE must be one of bsl::string, std::string, std::pmr::string (if supported), bsl::string_view, or bslstl::StringRef.
Declared in <bdls_filesystemutil.h>
static
int
move(
char const* oldPath,
char const* newPath);