[#BloombergLP-bdls-FilesystemUtil-findMatchingPaths-065c]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdls.adoc[bdls]::xref:BloombergLP/bdls/FilesystemUtil.adoc[FilesystemUtil]::findMatchingPaths
:relfileprefix: ../../../
:mrdocs:

Load into the specified `result` vector all paths in the filesystem matching the specified `pattern`&period; The &apos;&ast;&apos; character will match any number of characters in a filename&semi; however, this matching will not span a directory separator (e&period;g&period;, &quot;logs&sol;m&ast;&period;txt&quot; will not match &quot;logs&sol;march&sol;001&period;txt&quot;)&period; &apos;?&apos; will match any one character&period; &apos;&ast;&apos; and &apos;?&apos; may be used any number of times in the pattern&period; The special directories &quot;&period;&quot; and &quot;&period;&period;&quot; will not be matched against any pattern&period; Note that any initial contents of `result` will be erased, and that the paths in `result` will not be in any particular guaranteed order&period; Return the number of paths matched on success, and a negative value otherwise&semi; if a negative value is returned, the contents of `&ast;result` are undefined&period; The parameterized `STRING&lowbar;TYPE` must be one of `bsl&colon;&colon;string`, `std&colon;&colon;string`, `std&colon;&colon;pmr&colon;&colon;string` (if supported), `bsl&colon;&colon;string&lowbar;view`, or `bslstl&colon;&colon;StringRef`&period;

== Synopsis

Declared in `&lt;bdls&lowbar;filesystemutil&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
static
int
findMatchingPaths(
    xref:bsl/vector-00d.adoc[bsl::vector&lt;bsl::string&gt;]* result,
    char const* pattern);
----

== Description

WINDOWS&hyphen;SPECIFIC NOTE&colon; To support DOS idioms, the OS&hyphen;provided search function has behavior that we have chosen not to work around&colon; an extension consisting of wild&hyphen;card characters (&apos;?&apos;, &apos;&ast;&apos;) can match an extension or _no_ extension&period; E&period;g&period;, &quot;file&period;?&quot; matches &quot;file&period;z&quot;, but not &quot;file&period;txt&quot;&semi; however, it also matches &quot;file&quot; (without any extension)&period; Likewise, &quot;_&period;_&quot; matches any filename, including filenames having no extension&period; Also, on Windows (but not on Unix) attempting to match a pattern that is invalid UTF&hyphen;8 will result in an error&period;

IBM&hyphen;SPECIFIC WARNING&colon; This function is not thread&hyphen;safe&period; The AIX implementation of the system `glob` function can temporarily change the working directory of the entire program, casuing attempts in other threads to open files with relative path names to fail&period;


[.small]#Created with https://www.mrdocs.com[MrDocs]#
