[#BloombergLP-bdls-FilesystemUtil-remove-07] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdls.adoc[bdls]::xref:BloombergLP/bdls/FilesystemUtil.adoc[FilesystemUtil]::remove :relfileprefix: ../../../ :mrdocs: 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>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- 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 https://nvd.nist.gov/vuln/detail/cve-2022-21658[CVE‐2022‐21658]. [.small]#Created with https://www.mrdocs.com[MrDocs]#