Remove the file or directory at the specified path. If the path refers to a directory and the optionally specified recursiveFlag is true, recursively remove all files and directories within the specified directory before removing the directory itself. Return 0 on success and a non‐zero value otherwise. If path refers to a symbolic link, the symbolic link will be removed, not the target of the link. Note that if path is a directory, and the directory is not empty, and recursive is false, this method will fail. Also note that if the function fails when recursive is true, it may or may not have removed some files or directories before failing. Also note that if remove is called on "." or "..", it will fail with no effect. The parameterized STRING_TYPE must be one of bsl::string, std::string, std::pmr::string (if supported), bsl::string_view, or bslstl::StringRef.
Synopsis
Declared in <bdls_filesystemutil.h>
static
int
remove(
char const* path,
bool recursiveFlag = false);
Description
WINDOWS‐SPECIFIC WARNING: When recursiveFlag is true, it is possible for this function to descend into a directory symbolic link, resulting in the removal of files or directories that are outside the subtree of path. This situation occurs only if a directory is replaced by a symbolic link during the traversal. Note that when Developer Mode is not enabled, symbolic links can be created only by users with administrative privileges. If Developer Mode is on, using this function for recursive deletion can result in a vulnerability similar to CVE‐2022‐21658.
Created with MrDocs