[#BloombergLP-bdls-FilesystemUtil-remove-0e] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdls.adoc[bdls]::xref:BloombergLP/bdls/FilesystemUtil.adoc[FilesystemUtil]::remove :relfileprefix: ../../../ :mrdocs: `remove` overloads == Synopses Declared in `<bdls_filesystemutil.h>` 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`. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- static int xref:BloombergLP/bdls/FilesystemUtil/remove-07.adoc[remove]( char const* path, bool recursiveFlag = false); ---- [.small]#xref:BloombergLP/bdls/FilesystemUtil/remove-07.adoc[_» more..._]# Same as `remove(const char *, bool)`, but accepts a `STRING_TYPE` path. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class STRING_TYPE> static int xref:BloombergLP/bdls/FilesystemUtil/remove-0c.adoc[remove]( STRING_TYPE const& path, bool recursiveFlag = false); ---- [.small]#xref:BloombergLP/bdls/FilesystemUtil/remove-0c.adoc[_» more..._]# [.small]#Created with https://www.mrdocs.com[MrDocs]#