Rename a file or directory
path_rename (
old_fd: i32The file descriptor representing the base directory for the source pathold_path: i32A wasm pointer to a null-terminated string containing the source path of the file or directory to be renamedold_path_len: i32The length of the old_path stringnew_fd: i32The file descriptor representing the base directory for the target pathnew_path: i32A wasm pointer to a null-terminated string containing the target path with the new name for the file or directorynew_path_len: i32The length of the new_path string
) => The path_rename()
function renames a file or directory specified by the given path. It requires the PATH_RENAME_SOURCE
right on the source directory and the PATH_RENAME_TARGET
right on the target directory.
On POSIX systems, a similar functionality is provided by the rename()
function. It renames a file or directory with the specified source and target paths. The rename()
function is part of the POSIX standard and is widely supported across different platforms.
Note
The path_rename()
function renames a file or directory specified by the given source path to the target path. It checks the necessary rights on both the source and target directories. On POSIX systems, a similar functionality is provided by the rename()
function.